Java Quiz 03
Java Quiz 03
Java Quiz 03
class Test {
int i;
class Main {
Test t;
System.out.println(t.i);
Compile error
Garbage value
Runtime
Runtime error
Throws exception
Runs successfully
Q3. Which statement is not true in java language?
A public member of a class can be accessed in all the packages.
A private member of a class cannot be accessed by the methods of the same class.
Q4. To prevent any method from overriding, we declare the method as,
Static
Const
final
abstract
1,3
2,3
1,1
3,4
Q6. What is false about constructor?
. Which keyword is used by the method to refer to the object that invoked it?
Import
Catch
Abstract
This
Which of the following is a method having same name as that of its class?
finalize
delete
class
constructor
Which operator is used by Java run time implementations to free the memory of an
object when it is no longer needed?
delete
free
new
none of the mentioned
Which of the following variable declaration would NOT compile in a java program?
int var;
int VAR;
int var_1;
int 1_var;.