Shortcut Navigation:

Java Quiz

What is the size of a Char?

A class cannot be declared:

Following code will result in: int a = 3.5;

Following code will result in: int a1 = 5; double a2 = (float)a1;

Following code will result in: int a = 9/0;

Following code will result in: float a = 9/0;

A class can be transient

Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}

Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}

Following code will result in: class A { public static void main(String [] args) {A a = new B(); }} class B extends A {}

Methods that are marked protected can be called in any subclass of that class.

An abstract class can have non-abstract methods.

Java keywords are written in lowercase as well as uppercase.

What is an instanceof

Primitive datatypes are allocated on a stack.

Can you compare a boolean to an integer?

If class A implements an interface does it need to implement all methods of that interface?

Integer a = new Integer(2); Integer b = new Integer(2); What happens when you do if (a==b)?

The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code.

Inner classes can be defined within methods.

Synchronized is a keyword to tell a Thread to grab an Object lock before continuing execution.

The default statement of a switch is always executed.