Declaration and Access Control The object is created with new keyword At Compile-time Depends on the code At run-time None of these At Compile-time Depends on the code At run-time None of these 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 20 one two 20 one two 20 one one 20 one two 20 one two 20 one 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"); } }} two Compile error - char can't be permitted in switch statement. one Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these two Compile error - char can't be permitted in switch statement. one Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these 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. (I) and (II) (I), (II) and (III) Only (III) Only (I) (II) and (III) (I) and (II) (I), (II) and (III) Only (III) Only (I) (II) and (III) 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);}} Compile with error 5 6 Runtime Exception 0 Compile with error 5 6 Runtime Exception 0 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); }} 5 Compile with error Runtime Exception None of these 0 5 Compile with error Runtime Exception None of these 0 ANSWER DOWNLOAD EXAMIANS APP