Can a double value be cast to a byte
Yes, a double value can be cast to a byte.
Is the ternary operator written x : y ? z or x ? y : z
It is written x ? y : z.
Can an abstract class be final
An abstract class may not be declared as final.
What is the difference between class variable, member variable and automatic(local) variable
class variable is a static variable and does not belong to instance of class but
rather shared across all the instances
– member variable belongs to a particular instance of class and can be called from any
method of the class
– automatic or local variable is created on entry to a method and has only method
scope
How can you reference static variables
Via reference to any instance of the class
Code:
Computer comp = new Computer ();
comp.harddisk where hardisk is a static variable
comp.compute() where compute is a method
What is the difference between static and non-static variables
A static variable is associated with the class as a whole rather than with specific instances of a class.
Non-static variables take on unique values with each object instance
What are E and PI
E is the base of the natural logarithm and PI is mathematical value pi.
To what value is a variable of the boolean type automatically initialized
The default value of the boolean type is false.
Can a Byte object be cast to a double value
No. An object cannot be cast to a primitive value
When does the compiler supply a default constructor for a class?
The compiler supplies a default constructor for a class if no other constructors are provided