Declaration and Access Control Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class. static volatile native final abstract static volatile native final abstract 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 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. (I), (II) and (III) (II) and (III) (I) and (II) Only (I) Only (III) (I), (II) and (III) (II) and (III) (I) and (II) Only (I) Only (III) ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What is the result of compiling and running the following code?public class Tester{static int x = 4;public Tester(){System.out.print(this.x); // line 1Tester();}public static void Tester(){ // line 2System.out.print(this.x); // line 3}public static void main(String... args){ // line 4new Tester();}} 44 Compile error at line 1 (static x must be only accessed inside static methods) Compile error at line 4 (invalid argument type for method main ) Compile error at line 2 (constructors can't be static) Compile error at line 3 (static methods can't invoke this) 44 Compile error at line 1 (static x must be only accessed inside static methods) Compile error at line 4 (invalid argument type for method main ) Compile error at line 2 (constructors can't be static) Compile error at line 3 (static methods can't invoke this) 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"); } }} Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. two one Compile error - char can't be permitted in switch statement. None of these Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. two one Compile error - char can't be permitted in switch statement. None of these 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 None of these one two 10 Compile time error. one two 1 one two 0 None of these one two 10 Compile time error. one two 1 ANSWER DOWNLOAD EXAMIANS APP