Home Interviewquestions Java Interview Questions



Java Interview Questions
Posted on: January 9, 2008 at 12:00 AM
Question: How can you write a loop indefinitely? Answer: for(;;)--for loop; while(true)--always true, etc.

Java Interview Questions - Page 7

     

Question: How can you write a loop indefinitely?
Answer:
for(;;)--for loop; while(true)--always true, etc.

Question: . Can an anonymous class be declared as implementing an interface and extending a class?
Answer:
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

Question: What is the purpose of finalization?
Answer:
The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

Question: Which class is the superclass for every class.
Answer:
Object.

Question: What is the difference between the Boolean & operator and the && operator? 
Answer:
If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.

Question: What is the GregorianCalendar class?
Answer:
The GregorianCalendar provides support for traditional Western calendars.

Question: What is the SimpleTimeZone class?
Answer:
The SimpleTimeZone class provides support for a Gregorian calendar.

Question: Which Container method is used to cause a container to be laid out and redisplayed?
Answer:
validate()

Question: What is the Properties class?
Answer:
The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.

Question: What is the purpose of the Runtime class?
Answer:
The purpose of the Runtime class is to provide access to the Java runtime system.

Question:  What is the purpose of the System class? 
Answer:
The purpose of the System class is to provide access to system resources.

Related Tags for Java Interview Questions:
cclassormprocessforminterfaceobjectiounityportintprocessinganonymousforctefinalquestiontocleanupuniteachextendposprocssiextbotesupersuperitcleannotcanlipeimceinnormextendingasmntstioscaosleanjaceclesdeclareemendagercmeobjproppdowhichwerssuperclasssuesscolbagbeforeatanyquestishallivcollectmpleaandarcollectrtxtzssrocthswstabablarbatianswerhatfaceeclendingfinfinalizationgagarbagejepleplprocesprndonolonon


More Tutorials from this section

Ask Questions?    Discuss: Java Interview Questions   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.