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. (II) and (III) Only (I) (I) and (II) Only (III) (I), (II) and (III) (II) and (III) Only (I) (I) and (II) Only (III) (I), (II) and (III) 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;} Any class. Any class that extends Test. Any class in com.mypackage package. None of these Only the Test class. Any class. Any class that extends Test. Any class in com.mypackage package. None of these Only the Test class. 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);}} Runtime Exception 5 Compile with error 0 6 Runtime Exception 5 Compile with error 0 6 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 native static volatile abstract final native static volatile abstract 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 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 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); }} Compile with error 0 Runtime Exception None of these 5 Compile with error 0 Runtime Exception None of these 5 ANSWER DOWNLOAD EXAMIANS APP