Wednesday, October 24, 2007

CORE JAVA Interview Questions-Part16


Question: What class of exceptions are generated by the Java run-time system?

Answer: The Java runtime system generates RuntimeException and Error exceptions.

Question: What class allows you to read objects directly from a stream?

Answer: The ObjectInputStream class supports the reading of objects from input streams.

Question: What is the difference between a field variable and a local variable?

Answer: A field variable is a variable that is declared as a member of a class. A local variable is a variable that is declared local to a method.

Question: How are this() and super() used with constructors?

Answer: this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

Question: What is the relationship between a method's throws clause and the exceptions that can be thrown during the method's execution?

Answer: A method's throws clause must declare any checked exceptions that are not caught within the body of the method.

Question: Why are the methods of the Math class static?

Answer: So they can be invoked as if they are a mathematical code library.

Question: What are the legal operands of the instanceof operator?

Answer: The left operand is an object reference or null value and the right operand is a class, interface, or array type.

Question: What an I/O filter?

Answer: An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

Question: If an object is garbage collected, can it become reachable again?

Answer: Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.

Question: What are E and PI?

Answer: E is the base of the natural logarithm and PI is mathematical value pi.

Question: Are true and false keywords?

Answer: The values true and false are not keywords.

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com