true or false, code snippets and definitions
what is the size of float variable?
32 bit
which operator is considered to be with highest precedence?
a. (), []
b. ? :
c. =
d. %
a. (), []
Correct syntax for the main method of a java class?
a. public static int main ( String[] args)
b. public static void main ( string[] args)
c. none of the choices
d. Public static void main (String [] args)
e. Public int main ( string [] args)
d. Public static void main (String [] args)
what is an applet?
java program rhat runs in a web Browser
static methods are allowed to access variables using this.varName. (True or False)
False. static methods cannot access instance variables (non-static variables) using this.varName
, because this
refers to the current instance of the class, and static methods do not belong to any particular instance — they are associated with the class itself.
what is method overloading?
methods with the same name but different parameters
Objects are stored in Stack
false
Size of double Variable
64 bit
is an empty . java file a valid source file?
True
Primitive variables are stored on stack
True
waht is the default value of String variable
null
Does garbage collection guarantee that a program will not run out of memory
No, garbage collection does not guarantee it will free up enough memory to prevent out-of-memory errors.
is it legal to access a static method using an instance of the class
True
size of int variable
32 bit
what is a local variable?
variables defined inside methods, constructors or blocks
Method Overloading is a n example of
dynamic binding
what is the default value of char variable
‘\u0000’
output of the code snippet
int i = 1;
switch(i){
default: System.out.println(“default’
case 0 : System.out.println(“zero”);
break;
case 1 : System.out.print(“one”);
case 2: System.out.print(“two”);
}
compile time-error. default line