4)
JavaBeat Home SCJP 1.4 Home Objectives Forums Mock Exams Online Mock Exam Resources
Mock Exams
MockQuestions - 1 MockQuestions - 2 MockQuestions - 3 MockQuestions - 4
MockQuestions - 5 MockQuestions - 6 MockQuestions - 7 MockQuestions - 8
MockQuestions - 9 MockQuestions - 10 MockQuestions - 11 MockQuestions - 12
MockQuestions - 13 MockQuestions - 14 MockQuestions - 15 MockQuestions - 16
MockQuestions - 17 MockQuestions - 18 MockQuestions - 19 MockQuestions - 20
Mock Exam - 4
public class Test1{
static void method(Object obj){
System.out.println("Object");
}
static void method(String str){
System.out.println("String");
}
Q1 public static void main(String args[]){
method(null);
}
}
What will be the output?
A1 String
A2 Object
A3 null
A4 Compiler Error
A1 String
A2 Object
A3 null
A4 Compiler Error
class Test{}
public class Test3{
static void method(Object obj){
System.out.println("StringBuffer");
}
static void method(String str){
System.out.println("String");
}
static void method(Test t){
Q3 System.out.println("Test");
}
public static void main(String args[]){
method(null);
}
}
What will be the output?
A1 String
A2 Object
A3 Test
A4 Compiler Error
{
k = k * 2;
}
Q9 public static void main(String args[]){
System.out.println(k);
}
}
What will be the output?
A1 1
A2 2
A3 4
A4 Compiler Error