answersLogoWhite

0

What else can I help you with?

Continue Learning about Engineering

How do you read from an external file in java?

The class I find useful is the FileReader class in java.io. It allows you to read an external file in your program.For instance,Consider a file input.txt:HelloHow are you?1 2 3 4 5You can access it by:FileReader read = new FileReader("input.txt"); // pass the file name as a String//now the read is the file//can scan from the file using ScannerScanner scan = new Scanner(read);System.out.println( scan.nextLine()); // prints HelloSystem.out.println( scan.nextLine()); // prints How are you?while(scan.hasNextInt())System.out.print(scan.nextInt() + " "); // prints 1 2 3 4 5


Explain the Java class Loader architecture?

basic function of class loader is to read bytecodes into array and create namespace in namespace. there are two types of class loaders: promodia class loader and class loader objects 1. promodia class loader it loads all necessary classes required for VM, it is bootstrap class loader. 2. class loader objects there are 3 class loaders AppletClassLoader, RemoteClassLoader and SecurityClassloader. Sabarish R L


What is DataInputStream?

This section demonstrates you the use of DataInputStream class. The class DataInputStream allows to read primitive Java data types from an underlying input stream. It reads the file line by line.


Program in Java to create file and copy content of an existing file to it?

You need to use File class to create file in java and than Reader class implementation such as BufferedReder to read content.


Which scanner class method would you use to read integer as input?

The method Scanner.nextInt() returns an integer obtained as user input.