-
Convert List Object to Map Object
How to convert list object in to map object?
-
How many methods in the Serializable interface?
There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
-
Given the two methods:
void f() throws IOException
Which of the following is/are correct overriding method?
a) void f() throws IOException
b) public void f()
c) void f() throws FileNotFoundException
d) void f() throws Exception -
-
-
Which of the following is true about packages?
a) Classes in the same package can access each other.
b) The inherited class should be in the same package as the parent class.
c) Package name a.b implies, package b is inherits from package a.
d) Package access is next to private access in being restrictive. -
Call Main Function Explicitly
Can we call the main function explicitly? If Yes, How?
-
Swing provides ________ text components
Skill/Topic: AWT & AppletsA) fourB) SixC) Sixteen D) Thirtytwo
-
-
-
-
When to use Interface over abstract class?
Abstract Classes: Classes which cannot be instantiated. This means one cannot make a object of this class or in other way cannot create object by saying ClassAbs abs = new ClassAbs(); where ClassAbs is abstract class.Abstarct classes contains have one or more abstarct methods, ie method body only no implementation.Interfaces: These are same as abstract classes only difference is we an only define...
-
Select appropriate answers for the incomplete declaration listed below?
class A ______ B ______ C { } // line 4
a) The 1st blank should be extends and the 2nd blank should be implements.
b) The 1st blank should be implements and the 2nd blank should be extends.
c) B is a class and C is an interface
d) B and C can be either class or interface depending upon the placement of extends or implements in the 1st or 2nd blank. -
Which of the following options can be inserted at the commented line to compile the given code:
cpublic class Class1 {
Class1(String s){ }
Class1() { }
}
class Class2 extends Class1{
Class2(){ }
Class2(String s) {super(s);}
void m1() {
// insert code here
}
}
a) Class1 c1 = new Class1("HCL"){ }
b) Class1 c1 = new Class2(){ };
c) Class2 c3 = new Class1(String s){};
d) Class1 c1 = new Class1(100){ }; -
Thread and Runnable
When we will use thread and runnable in java program ?
-
What is the output of below syntax?
java{
cath(Exception e)
{System.out.println("A");
}
cath(ClassNotFoundException e1)
{System.out.println("b");
}
cath(InvalidException e2)
{System.out.println("c");
}
finally()
{
System.out.println("x");
}
-
What are the legal operands of the instanceof operator
The left operand is an object reference or null value and the right operand is a class,interface, or array type.
-
Which of the following methods are methods of the Math class?
A) absolute( )B) log( )C) cosine( )D) sine( )
-
-
Which of the following statements correctly describes the relation between an object and the instance variable it stores? (Select multiple)
A) Each new object has its own distinctive set of instance variablesB) Each object has a copy of the instance variables of its classC) the instance variable of each object are seperate from the variables of other objectsD) The instance variables of each object are stored together with the variables of other objects
Java Interview Questions
Ans