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 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 Compile with error Runtime Exception 5 6 0 Compile with error Runtime Exception 5 6 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control A package is a collection of Classes Interfaces Classes and Interfaces Editing tools and Interfaces Editing tools Classes Interfaces Classes and Interfaces Editing tools and Interfaces Editing tools 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"; }} xyz abc Compilation clean but no output None of these Compilation fails xyz abc Compilation clean but no output None of these Compilation fails ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Choose all the lines which if inserted independently instead of "//insert code here" will allow the following code to compile:public class Test{ public static void main(String args[]){ add(); add(1);add(1, 2); }// insert code here} static void add(int[]... args){} static void add(int... args, int y){} static void add(int...args){} void add(Integer... args){} static void add(int args...){} static void add(int[]... args){} static void add(int... args, int y){} static void add(int...args){} void add(Integer... args){} static void add(int args...){} ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction? Declare the method with the keyword public and private. Declare the method with the keyword protected. Declare the method with the keyword private. Do not declare the method with any accessibility modifiers. Declare the method with the keyword public. Declare the method with the keyword public and private. Declare the method with the keyword protected. Declare the method with the keyword private. Do not declare the method with any accessibility modifiers. Declare the method with the keyword public. ANSWER DOWNLOAD EXAMIANS APP