Declaration and Access Control A package is a collection of Editing tools Interfaces Classes and Interfaces Classes Editing tools and Interfaces Editing tools Interfaces Classes and Interfaces Classes Editing tools and Interfaces ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What is the result of compiling and running the following code?class Base{ private Base(){ System.out.print("Base"); }}public class test extends Base{ public test(){ System.out.print("Derived"); } public static void main(String[] args){ new test(); }} Compilation Error Derived BaseDerived Exception is thrown at runtime Compilation Error Derived BaseDerived Exception is thrown at runtime ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control You have the following code in a file called Test.javaclass Base{ public static void main(String[] args){ System.out.println("Hello"); }}public class Test extends Base{}What will happen if you try to compile and run this? Runtime error Compiles and runs printing Compiles and runs with no output. It will fail to compile. Runtime error Compiles and runs printing Compiles and runs with no output. It will fail to compile. ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output after compiling and running following program code?public class Test{ static int a; public static void main(String[] args){ System.out.println("one"); call(1); } static void call(int a){ this.a=10; System.out.println("two "+a); }} one two 0 Compile time error. one two 1 one two 10 None of these one two 0 Compile time error. one two 1 one two 10 None of these ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output for the below code?public class Test{ static{ int a = 5; } public static void main(String[] args){ System.out.println(a); }} 0 5 Runtime Exception Compile with error None of these 0 5 Runtime Exception Compile with error None of these ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output for the below code?static public class Test{ public static void main(String[] args){ char c = 'a'; switch(c){ case 65 : System.out.println("one");break; case 'a': System.out.println("two");break; case 3 : System.out.println("three"); } }} one two Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these one two Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these ANSWER DOWNLOAD EXAMIANS APP