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 final native abstract volatile static final native abstract volatile 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"; }} abc Compilation clean but no output Compilation fails xyz None of these abc Compilation clean but no output Compilation fails xyz None of these 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(); }} Exception is thrown at runtime Compilation Error Derived BaseDerived Exception is thrown at runtime Compilation Error Derived BaseDerived 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;}} Hello2 InsideDemo 10 InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. Compilation error. InsideDemo 10 Hello2 Hello2 InsideDemo 10 InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. Compilation error. InsideDemo 10 Hello2 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output?public class Test{static{int a = 5;}public static void main(String args[]){new Test().call();}void call(){this.a++;System.out.print(this.a);}} 5 0 Compile with error 6 Runtime Exception 5 0 Compile with error 6 Runtime Exception 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); }} None of these 5 Runtime Exception Compile with error 0 None of these 5 Runtime Exception Compile with error 0 ANSWER DOWNLOAD EXAMIANS APP