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 Only the Test class. 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. 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"; }} Compilation clean but no output xyz abc Compilation fails None of these Compilation clean but no output xyz abc Compilation fails None of these ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output after the following program is compiled and executed?public class Test{ public static void main(String args[]){ int x = 10; x = myMethod(x--); System.out.print(x); } static int myMethod(final int x){ return x--; }} The program will lead to compilation error. The program will compile successfully and display 10 as output. None of these The program will lead to runtime error. The will compile successfully and display 9 as output. The program will lead to compilation error. The program will compile successfully and display 10 as output. None of these The program will lead to runtime error. The will compile successfully and display 9 as output. 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 two 20 one 20 one two one 20 one two 20 one 20 one two one ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control A package is a collection of Classes Editing tools Classes and Interfaces Editing tools and Interfaces Interfaces Classes Editing tools Classes and Interfaces Editing tools and Interfaces Interfaces 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 5 6 Compile with error Runtime Exception 0 5 6 Compile with error Runtime Exception ANSWER DOWNLOAD EXAMIANS APP