Java Quiz 1 – Advanced

Sharing is caring

Welcome to your Java Quiz 1 - Advanced

1. 
What is the implicit return type of a constructor?

2. 
What is output of the following code?

int Integer = 50;

char String  = ‘I’;

System.out.print(Integer);

System.out.print(String);

3. 
Identify the modifier which cannot be used for constructor

4. 
Which of the following keyword when used before a variable, makes it a class level variable and not an instance variable?

5. 
When is the finalize() method called?

6. 
Which of the following is a valid syntax for declaring an array?

7. 
What is the output of the following code?

try{

       int Integer = 50/0;

} catch(Exception e){

       System.out.println(“from exception”);

} catch(ArithmeticException ae){

       System.out.println(“from Arithmetic exception”);

}

8. 
In which of the following is toString() method defined?

9. 
What does the following code do to the String “camera”?

“camera”.replace(‘a’,’I’)


Sharing is caring

Leave a Reply

Your email address will not be published. Required fields are marked *