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
2
What is static method override?
  1. Having same static method in the base class and derived class with same signature and return type, is called as static method overriding.
  2. Having same function name for multiple static methods in the same class, with either different number of parameters or different type of parameters or different order of parameters is called as static method overriding.
  3. Static methods can not be overridden in the exact sense of the word, but they can hide parent static methods in the derived classes.
  4. none
Show Answer
Share Facebook gmail Twitter
3
What is method overriding?
  1. Having the same method with same name and signature in super class and sub class is called as method overriding.
  2. Having the same method with same name, same signature, and same covariant return type in super class and sub class is called as method overriding.
  3. Having mutiple methods  with same name but different signatures in a class, is called as method overriding. 
  4. none
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
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
Show Answer
Share Facebook gmail Twitter
16
A file  contains the following code:

package p1;
public class Student {}
class Test{}

For the code to compile, the main method should be in
  1. Test class
  2. Student class
  3. Both Test and Student class
  4. Anywhere either in Test class or in Student class or in both
Show Answer
Share Facebook gmail Twitter
17
There are three classes Vehicle, Bicycle, and Truck. What are the likely relationships among these classes?
  1. Vehicle is the superclass, Bicycle and Truck are subclasses of Computer.  
  2. Truck is the superclass, Bicycle and Vehicle are subclasses of Truck.  
  3. Vehicle, Bicycle and Truck are sibling classes.  
  4. Vehicle is a superclass, Bicycle is a subclasses of Vehicle, and Truck is a subclass of Vehicle
Show Answer
Share Facebook gmail Twitter
18
System.out.print(new MyClass());
Which of the following method(s) in MyClass  ensures that 1 is printed when the above statement  executes?
  1. public String toString(){return "1";}
  2. public int toString(){return 1;}
  3. public String toString(){return 1;}
  4. public void toString(){System.out.print("MyString");}
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :