Sun Certified Java Programmer(SCJP 1.

4)
JavaBeat Home SCJP 1.4 Home Objectives Forums Mock Exams Online Mock Exam Resources

Mock Exams MockQuestions MockQuestions MockQuestions MockQuestions MockQuestions 1 5 9 13 17 MockQuestions MockQuestions MockQuestions MockQuestions MockQuestions 2 6 10 14 18 MockQuestions MockQuestions MockQuestions MockQuestions MockQuestions 3 7 11 15 19 MockQuestions MockQuestions MockQuestions MockQuestions MockQuestions 4 8 12 16 20

Mock Exam - Nested Classes public class Test1{ private static int i = 10; static class Inner extends Test1{ int i; public void method(){ System.out.println(i); } } public static void main(String args[]){ new Test10.Inner().method(); } } which of the following statement in //? will print "Inner class"? 10 0 nothing is printed. Compiler error. which of the following modifiers are applied to the nested classes class? private protected public static All the above. which of the following modifiers are applied to the top level classes ? static private strictfp abstract All the above. which modifer is uesd to stop overridding a method? final static abstract None of the above.

Q1

A1 A2 A3 A4 Q2 A1 A2 A3 A4 A5 Q3 A1 A2 A3 A4 A5 Q4 A1 A2 A3 A4

public abstract final class Test5{ public static void main(String args[]){ System.out.println("Modifiers"); } Q5 } what will be the output?

A1 A2 A3 A4 Q6 A1 A2 A3 A4 Q7 A1 A2 A3 A4

Modifiers Compiler error exception thrown at runtime None of the above which of the following are valid syntax for a toplevel class? public static class Test6{} public abstrct class Test6{} private final class Test6{} public final class Test6{} which of the following are valid syntax for nested classes? private final abstract class Test7{} private final class Test7{} private static class Test7{} protected abstract class Test7{} public class Test8{ class Inner{ public void method(){ System.out.println("Inner class"); } } public static void main(String args[]){ // ? } } which of the following statement in //? will print "Inner class"? new Test8.Inner().method(); new Test8().Inner().method(); new Test8.Inner.method(); Compiler error.

Q8

A1 A2 A3 A4

public class Test9{ static class Inner{ public void method(){ System.out.println("Inner class"); Q9 } } public static void main(String args[]){ // ?

} } which of the following statement in //? will print "Inner class"? A1 new Test9.Inner().method(); A2 new Test9().Inner().method(); A3 new Test9.Inner.method(); A4 Compiler error. Q10 which of the following modifiers are applied to local classes(classses inside method)?. A1 A2 A3 A4 1 2 private public protected None of the above. Answers new Test8.Inner().method();. All the above. strictfp 3 abstract 4 final 5 Compiler error public abstrct class Test6{} 6 public final class Test6{} private final class Test7{} 7 private static class Test7{} protected abstract class Test7{} 8 Compiler error. 9 new Test8.Inner().method();. 10 None of the above
JavaBeat 2005, India (www.javabeat.net) Submit a Site - Directory - Submit Articles