Find jobs | Jobseekers
Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career Services Resume Services Interview questions Articles Books

Java Interview Questions


Java Interview questions and answers- Part 1

Part 1 | Part 2 | Part 3 | Part 4 | Part 5

Java Interview questions with answers posted on July 22, 2008 at 8:10 am
Question - What is package in JAVA?

Answer
Packages group together related classes and interfaces. Packages avoid name conflicts. Classes in java are group together in a package using "package" keyword.

Example,

package P1;
public class Class1
{
}
public class Class2
{
}
Question - Can we have parameterized constructors in Java?
Answer
Yes, we can have.
This is also called as constructor overloading.
Example

Class clsEmp
{
          int age;
          clsEmp()
          {
                   age = 21;                
          }
          clsEmp(int a)
          {        
                  age = a;
          }
}
Question - Explain the difference between static and non-static member of a class.

Answer
A static member has only one copy of instance variables that share among all the objects of the class whereas a non-static member has its own copy of instance variable.

Question - Define inner class in Java

Answer
Class that is nested within a class is called as inner class. The inner class can access private members of the outer class. It is mainly used to implement data structure and some time called as a helper class.

Question - Describe the use of “instanceof” keyword.

Answer
“instanceof” keyword is used to check what is the type of object.

Question - What is the purpose of “this” keyword?  

Answer
“this” keyword is used to refer current instance of object. 

Question - What is the disadvantage of garbage collector?

Answer
Although garbage collector runs in its own thread, still it has impact on performance. It adds overheads since JVM has to keep constant track of the object which are not referenced and then free these unreferenced objects. 

Question - What are the methods in java to force garbage collector to run?

Answer
Garbage collector can be force to run using “System.gc” or “Runtime.gc”.

Question - Define Applet.

Answer
An applet is a small server side application that can be loaded and controlled on the browser by the client application. An applet has limited access to resources in order to ensure security. 

Question - Explain the life cycle of an applet. 

Answer
Below are sequences of methods that describes the life cycle of an applet.

Init() 
This is first method called when applet loads. This method can be used to set applet attributes like color, fonts etc.

Start()
This method starts a thread in which it runs the paint method.

Paint()
This method is called every time when an applet has to re-display.

Stop()
It is called when the user goes to the other page.

Distroy()
This is called when the browser exits. We can use this method for cleaning non java resources.
          

Part 1 | Part 2 | Part 3 | Part 4 | Part 5

Click here to share knowledge by answering these questions

  1. Define class and object.
  2. What is Java Virtual Machine?
  3. Define Just-In-Time compilation.
  4. Explain how we implement inheritance in JAVA.
  5. Explain Abstract class.
  6. What are packages?
  7. Define Interface.
  8. Define constructors and destructors in JAVA.
  9. List out the difference between an Interface and an Abstract class.
  10. What is garbage collection in Java?
  11. Explain in brief synchronization in respect to multithreading.
  12. What are the different ways of using thread in Java?
  13. Define pass by reference and pass by value.
  14. Explain in brief HashMap and Map.
  15. List out difference between HashMap and HashTable.
  16. List out difference between Vector and ArrayList.
  17. Define Swing and Awt.
  18. What is the difference between a constructor and a method?
  19. Define Iterator in JAVA.
  20. What is static in JAVA?
  21. What is final in JAVA?
  22. Explain Collections API in JAVA.
  23. Describe List interface in JAVA.
  24. What is the Vector class?
  25. When do we use Locale class?
  26. What is the use of the SimpleTimeZone class?
  27. What is the Collection interface?
  28. What is the use of Hashtable?
  29. Define class and object.
Click here to share knowledge by answering these questions

 
Today's Hot Jobs
C++  SQL Server
.NET  Java  Oracle
Finance  Marketing
Seekers  Employers
Copyright © 2008 CareerRide.com. All rights reserved.