Select chapter



basics (7.papers)
constructors (1.papers)
packages (1.papers)
inheritance (7.papers)
misc (3.papers)
exceptions (5.papers)
threads (4.papers)
overloading (1.papers)
jsp (3.papers)
servlets (9.papers)
jdbc (2.papers)
util (1.papers)
xml (2.papers)
IO stream (3.papers)
Hide

Sponsored Links


  

java interview questions and answers

Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
3
Which of the following is true about interfaces of java?
  1. Interfaces cannot be instantiated
  2. Interfaces cannot be used as reference
  3. A class can implement more than only upto 10 interfaces
  4. An interface is another name for abstract class
Show Answer
Share Facebook gmail Twitter
4
When a class implements an interface, what all it should do?
  1. It should redefine all the constants of the interface.
  2. class should give method definitions for all the methods available in the interface.
  3. It must declare a variable for each constant in the interface.  
  4. It must include a private method for each method in the interface.  
Show Answer
Share Facebook gmail Twitter
5
What is true about placement of access specifiers?
  1. private and public classes are not top level classes
  2. private and protected classes are not top level classes
  3. protected and public classes are not top level classes
  4. private, protected and public classes are not top level classes
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
Which of the following statements are true?
  1. A class can extend more than one class
  2. An interface extends a class
  3. abstract keyword can be used with interface definition
  4. interface must contain at least one abstract method
Show Answer
Share Facebook gmail Twitter
8
Which of the following statement is false?
  1. An Interface can only have public members 
  2. All variables in an Interface are by default - public static final 
  3. An interface is used  when  a class needs to inherit from more than one class 
    
  4. An interface must be declared public
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
Which of the following is true?
  1. An abstract class cannot contain final members
     
  2. An interface cannot be declared as final.
    
  3. An abstract class should have at least one abstract method.
  4. All interfaces inherits from Object class
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
15
What will happen if we compile and run the given classes:

public interface I1 {
 void m1(int i); //Line 1 
}
public interface I2 extends I1{
 void m2(); //Line 2
 void m1(); //Line 3 
}
public class Class1 implements I2 {  
 public void m1(int i){System.out.println(i);}
 public void m2(){System.out.println("M2");}
}
  1. Interface I2 does not compile as void m1(int i) not declared
  2. Interface I2 does not compile as void m1() is declared
  3. Only Class1 does not compile as I2.m1() not implemented
  4. Both I2 and Class1 does not compile
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :