Java Interview Questions - Page 1

Java Interview Questions by Inigo Nirmal Question: Can a private method of a superclass be declared within a subclass? Answer: Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way fo

Tutorials   
Java Interview Questions with Answers Hibernate Interview Questions - What is Hibernate Framework? Hibernate Interview Questions JSF Basic Interview Questions Important Interview Questions in Core Java Core java Interview Questions XML Interviews Question page8,xml Interviews Guide,xml Interviews XML Interviews Question page7,xml Interviews Guide,xml Interviews XML Interviews Question page6,xml Interviews Guide,xml Interviews XML Interviews Question page5,xml Interviews Guide,xml Interviews XML Interviews Question page1,xml Interviews Guide,xml Interviews XML Interviews Question page30,xml Interviews Guide,xml Interviews XML Interviews Question page29,xml Interviews Guide,xml Interviews XML Interviews Question page28,xml Interviews Guide,xml Interviews XML Interviews Question page27,xml Interviews Guide,xml Interviews XML Interviews Question page26,xml Interviews Guide,xml Interviews XML Interviews Question page25,xml Interviews Guide,xml Interviews XML Interviews Question page24,xml Interviews Guide,xml Interviews XML Interviews Question page23,xml Interviews Guide,xml Interviews XML Interviews Question page22,xml Interviews Guide,xml Interviews XML Interviews Question page21,xml Interviews Guide,xml Interviews XML Interviews Question page1,xml Interviews Guide,xml Interviews XML Interviews Question page18,xml Interviews Guide,xml Interviews XML Interviews Question page17,xml Interviews Guide,xml Interviews XML Interviews Question page16,xml Interviews Guide,xml Interviews XML Interviews Question page15,xml Interviews Guide,xml Interviews XML Interviews Question page14,xml Interviews Guide,xml Interviews XML Interviews Question page13,xml Interviews Guide,xml Interviews XML Interviews Question page11,xml Interviews Guide,xml Interviews XML Interviews Question page1,xml Interviews Guide,xml Interviews SQL PL/SQL Terms Deadlock JSF Interview Questions Tomahawk inputCalendar tag Java Questions & Java FAQ J2EE Interviews Question page9,J2EE Interviews Guide,J2EE Interviews J2EE Interviews Question page8,J2EE Interviews Guide,J2EE Interviews J2EE Interviews Question page7,J2EE Interviews Guide,J2EE Interviews J2EE Interviews Question page6,J2EE Interviews Guide,J2EE Interviews

Ads

Ads

Java Interview Questions - Page 1

     

Java Interview Questions by Inigo Nirmal

Question: Can a private method of a superclass be declared within a subclass?
Answer:
Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.

Question: Why Java does not support multiple inheritence ? 
Answer:
Java DOES support multiple inheritance via interface implementation.
 

Question:What is the difference between final, finally and finalize?
Answer:
o final - declare constant
   o finally - handles exception
   o finalize - helps in garbage collection
 

Question: Where and how can you use a private constructor.
Answer:
Private constructor can be used if you do not want any other class to instanstiate the object , the instantiation is done from a static public method, this method is used when dealing with the factory method pattern when the designer wants only one controller (fatory method ) to create the object.
 

Question: In System.out.println(),what is System,out and println,pls explain? 
Answer:
System is a predefined final class,out is a PrintStream object and println is a built-in overloaded method in the out object.
 

Question: What is meant by "Abstract Interface"? 
Answer:
First, an interface is abstract. That means you cannot have any implementation in an interface. All the methods declared in an interface are abstract methods or signatures of the methods.
  

Question: Can you make an instance of an abstract class? For example - java.util.Calender is an abstract class with a method getInstance() which returns an instance of the Calender class. 
Answer:
No! You cannot make an instance of an abstract class. An abstract class has to be sub-classed. If you have an abstract class and you want to use a method which has been implemented, you may need to subclass that abstract class, instantiate your subclass and then call that method.
 

Question: What is the output of x<y? a:b = p*q when x=1,y=2,p=3,q=4?
Answer:
When this kind of question has been asked, find the problems you think is necessary to ask before you give an answer. Ask if variables a and b have been declared or initialized. If the answer is yes. You can say that the syntax is wrong. If the statement is rewritten as: x<y? a:(b=p*q); the return value would be variable a because the x is 1 and less than y = 2; the x < y statement return true and variable a is returned.

Question: What is the difference between Swing and AWT components?
Answer:
AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.

Question: Why Java does not support pointers?
Answer: Because pointers are unsafe. Java uses reference types to hide pointers and programmers feel easier to deal with reference types without pointers. This is why Java and C# shine.

Advertisements

Ads
Share on Google+Share on Google+

Java Interview Questions - Page 1

Posted on: January 19, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Java Interview Questions - Page 1   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
ramesh
December 5, 2011
java

learn complete information about java and tips to follow all the latest information about the topic and found of new things and modules
Aditya paliwal
February 17, 2012
abstract interface

plzz explain abstract interface

Ads

 

Ads