MCQs
Variable c has been dynamically initialized to square root of a * a + b * b, during run time.
output:
$ javac dynamic_initialization.java
$ java dynamic_initialization
5.0
Answer: D
Explanation:all string literals must begin and end in same line.
When an array is declared using new operator then all of its elements are initialized to 0
automatically. for loop body is executed 5 times as whenever controls comes in the loop
i value is incremented twice, first by i++ in body of loop then by ++i in increment condition
of for loop.
output:
$ javac array_output.java
$ java array_output
1 2 3 4 5
None
output:
$ javac evaluate.java
$ java evaluate
40
Keywords are specially reserved words which can not be used for naming a user defined
variable, example : class, int, for etc.
None.
We can use binary ampersand operator on integers/chars (and it returns an integer) or on
booleans (and it returns a boolean).
Data type long literals are appended by an upper or lowercase L.
Data type long literals are appended by an upper or lowercase L. 0x99fffL is hexadecimal
long literal.