Declaration and Access Control Which statements are most accurate regarding the following classes?class A{ private int i; protected int j;}class B extends A{ private int k; protected int m;} An object of B contains data fields j, m. An object of B contains data fields i, j, k, m. An object of B contains data fields k, m. An object of B contains data fields j, k, m. An object of B contains data fields j, m. An object of B contains data fields i, j, k, m. An object of B contains data fields k, m. An object of B contains data fields j, k, m. 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 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); }} 20 one 20 one two one one two 20 20 one 20 one two one one two 20 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Consider the following two classes declared and defined in two different packages, what can be added in class B to form what considered a correct access to class A from main() method of class B?package subPackage;public class A { }package anotherPackage;// line 1public class B{public static void main(String[] args){// line 2}}1. At line1 add noting; At line2 add: new A();2. At line 1 add: import package.*; at line 2 add : new subPackage.A();3. At line 1 add: import subPackage.*; at line 2 add : new A();4. At line 1 add: import subPackage.A; at line 2 add : new A(); 2 and 4 1 and 2 3 and 4 1 and 3 2 and 4 1 and 2 3 and 4 1 and 3 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 Compiles and runs with no output. Compiles and runs printing It will fail to compile. Runtime error Compiles and runs with no output. Compiles and runs printing It will fail to compile. 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"); } }} Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these one two Compile error - char can't be permitted in switch statement. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these one two ANSWER DOWNLOAD EXAMIANS APP