The FileInputStream class is used to is used to read binary data from a file. It is used to perform simple file input operations. It reads data in a sequential manner, but can skip a region of data as per requirement. It generally reads data in a sequential manner, but can skip a region of data as per requirement. FileInputStream class can be instantiated by using any of the following three constructors:
Archive for October, 2009
What is fileInputStream class?
Author: Daisy WilliamsOct 31
What is data-type conversion?
Author: Daisy WilliamsOct 30
Data type conversion is a technique of converting the data type of a variable to another data type. Two kinds of data type conversions are available in Java.
- Automatic: Automatic conversion takes place when the following two conditions are fulfilled:
- The two types are compatible.
- The destination type is larger than the source type.
Which class is used to provide methods for reading and writing console objects?
Author: Daisy WilliamsOct 29
The Console class is used to provide methods to read from and write to the console objects. It extends the Object class. It provides the readPassword() method to read a password from the console. If the underlying virtual machine has a console, it can be obtained by invoking the System.console() method. If no console device is available, then an invocation of the System.console() method returns null.
The Console class provides the following methods:
How to declare a package?
Author: Daisy WilliamsOct 28
The package statement is used to declare packages. The word package is a keyword in Java. This statement is not technically needed to write a complete Java program. However, if it appears, it must be the first executable statement in the program. Only comments or white spaces are allowed before a package statement. There can be only one package declaration in a program. If no package declaration appears, the class will belong to the default package.
For example, the following source code file defines a class named ClassA in the package named package4:
package package4;