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. native static volatile abstract final native static volatile abstract final ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Determine output:public class InitDemo{static int i = demo();static{ System.out.print(i); }InitDemo(){System.out.print("hello1");}public static void main(String... args){ System.out.print("Hello2");} static int demo(){ System.out.print("InsideDemo");return 10;}} Compilation error. Hello2 InsideDemo 10 InsideDemo 10 Hello2 InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. Compilation error. Hello2 InsideDemo 10 InsideDemo 10 Hello2 InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output?public class Test{ public static void main(String[] args){ String value = "abc"; changeValue(value); System.out.println(value); } public static void changeValue(String a){ a = "xyz"; }} None of these abc Compilation clean but no output xyz Compilation fails None of these abc Compilation clean but no output xyz Compilation fails ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Determine Output:class MyClass{ static final int a = 20; static final void call(){ System.out.println("two"); } static{ System.out.println("one"); }}public class Test{ public static void main(String args[]){ System.out.println(MyClass.a); }} one two 20 one 20 one two 20 one one two 20 one 20 one two 20 one 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 1 None of these Compile time error. one two 10 one two 0 one two 1 None of these Compile time error. one two 10 one two 0 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? It will fail to compile. Compiles and runs with no output. Runtime error Compiles and runs printing It will fail to compile. Compiles and runs with no output. Runtime error Compiles and runs printing ANSWER DOWNLOAD EXAMIANS APP