Declaration and Access Control Choose the correct statement. Restriction on static methods are: I. They can only call other static methods.II. They must only access static data.III. They cannot refer this or super in any way. Only (III) (II) and (III) Only (I) (I) and (II) (I), (II) and (III) Only (III) (II) and (III) Only (I) (I) and (II) (I), (II) and (III) 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); }} None of these one two 10 Compile time error. one two 0 one two 1 None of these one two 10 Compile time error. one two 0 one two 1 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Which statements are most accurate regarding the following classes?class A{ private int i; protected int j;}class B extends A{ private int k; protected int m;} An object of B contains data fields j, k, m. An object of B contains data fields j, m. An object of B contains data fields k, m. An object of B contains data fields i, j, k, m. An object of B contains data fields j, k, m. An object of B contains data fields j, m. An object of B contains data fields k, m. An object of B contains data fields i, j, k, m. 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 Runtime Exception 5 None of these Compile with error 0 Runtime Exception 5 None of these Compile with error 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"); } }} two None of these Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. one two None of these Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. one 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? Compiles and runs printing Runtime error It will fail to compile. Compiles and runs with no output. Compiles and runs printing Runtime error It will fail to compile. Compiles and runs with no output. ANSWER DOWNLOAD EXAMIANS APP