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"; }} xyz None of these abc Compilation clean but no output Compilation fails xyz None of these abc Compilation clean but no output Compilation fails ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What can directly access and change the value of the variable qusNo?package com.mypackage;public class Test{ private int qusNo = 100;} None of these Any class in com.mypackage package. Any class. Only the Test class. Any class that extends Test. None of these Any class in com.mypackage package. Any class. Only the Test class. Any class that extends Test. ANSWER DOWNLOAD EXAMIANS APP
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. final volatile static abstract native final volatile static abstract native 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);}} 0 Runtime Exception 6 5 Compile with error 0 Runtime Exception 6 5 Compile with error 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"); } }} one two None of these Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. Compile error - char can't be permitted in switch statement. one two None of these Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. Compile error - char can't be permitted in switch statement. 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 IllegalArgumentException is thrown at runtime. InsideDemo 10 Hello2 InsideDemo 10 Hello2 hello1 Compilation error. Hello2 InsideDemo 10 IllegalArgumentException is thrown at runtime. InsideDemo 10 Hello2 InsideDemo 10 Hello2 hello1 ANSWER DOWNLOAD EXAMIANS APP