Unit 3 - Study Material Oops
Unit 3 - Study Material Oops
• These are the exceptions that are not checked at compile time. In
C++, all exceptions are unchecked, so it is not forced by the compiler’s
to either handle or specify the exception.
• In Java, exceptions under Error and RuntimeException classes are
unchecked exceptions.
Built-in Exception
Object
inherits
Scanner
Different methods in Scanner Class
Method Description
void mark(int readAheadLimit) It is used for marking the present position in a stream.
void close() It closes the input stream and releases any of the system
resources associated with the stream.
Command Line Arguments in java
Console class in Java
• The Java Console class is be used to get input from console. It
provides methods to read texts and passwords.
• Java application generally uses the data output stream to write data
that can later be read by a data input stream.
Syntax
InputStream input = new FileInputStream("D:\\testout.txt");
DataInputStream inst = new DataInputStream(input);
Character Streams
if (outputStream != null) {
outputStream.close();
}
File Output Stream
• FileOutputStream is an output stream for writing data to a File or to a
FileDescriptor.
Syntax