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 fails xyz None of these Compilation clean but no output abc Compilation fails xyz None of these Compilation clean but no output abc ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What is the output for the below code ?public class A{ static{ System.out.println("static"); } { System.out.println("block"); } public A(){ System.out.println("A"); } public static void main(String[] args){ A a = new A(); }} static A A block static A None of these static block A static A A block static A None of these static block A 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);}} 6 0 5 Runtime Exception Compile with error 6 0 5 Runtime Exception Compile with error ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control The object is created with new keyword None of these At run-time Depends on the code At Compile-time None of these At run-time Depends on the code At Compile-time 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. Only (I) (I), (II) and (III) Only (III) (II) and (III) (I) and (II) Only (I) (I), (II) and (III) Only (III) (II) and (III) (I) and (II) 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); }} Compile time error. None of these one two 0 one two 10 one two 1 Compile time error. None of these one two 0 one two 10 one two 1 ANSWER DOWNLOAD EXAMIANS APP