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 abstract final native volatile static abstract final native 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"; }} Compilation clean but no output abc xyz Compilation fails None of these Compilation clean but no output abc xyz Compilation fails None of these 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 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. Compiles and runs printing 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 one two one two 20 one 20 20 one one two one two 20 one 20 20 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output after the following program is compiled and executed?public class Test{ public static void main(String args[]){ int x = 10; x = myMethod(x--); System.out.print(x); } static int myMethod(final int x){ return x--; }} The program will lead to runtime error. The program will compile successfully and display 10 as output. The program will lead to compilation error. None of these The will compile successfully and display 9 as output. The program will lead to runtime error. The program will compile successfully and display 10 as output. The program will lead to compilation error. None of these The will compile successfully and display 9 as output. 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 Compile with error 0 5 Runtime Exception None of these Compile with error 0 5 Runtime Exception ANSWER DOWNLOAD EXAMIANS APP