JAVA: Question Set – 05

JAVA: Question Set – 05

What is the difference between System.err, System.out, and

  • is used to take input from the user usually through a keyboard and is used as a standard input stream.
  • System.out is used to print the output on the screen and is used as a standard output stream. System.err is used to output the error in the program on the screen.

Does Java make use of pointers?

Java directly or explicitly does not make use of pointers. But, the internal pointer is used in Java.

When will the finally block not get executed?

The finally block does not execute when there is a JVM crash or, the System.exit() method is called in the try block which is before the finally block.

Define IS-A and HAS-A relations in Java.

Whenever in Java, one class inherits or extends another class, it is called an IS-A relationship. HAS-A relationship is when an instance of one class is used in another class.