Java Interview Questions
1 .
What are all the Java primitive data conversion rules?
• A boolean type may not be converted to non-boolean type.
• That is you cannot assign a boolean value to non-boolean type and vice versa.
• A non-boolean type may be converted to non-boolean type provided that the conversion is widening.
2 .
What is the difference between the prefix and postfix forms of the ++ operator?
The prefix form performs the increment operation and returns the value of the increment operation. The postfix form returns the current value all of the expression and then performs the increment operation on that value.
3 .
Can bitwise operators used in Boolean operations?
The Bitwise operators can also be used in Boolean operations. If applied to boolean it uses true or false which are equivalent to 1 and 0.
4 .
What is the difference between the Boolean & operator and the && operator?
If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The &&  operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
5 .
What are control statements?
Control statements are the statements which alter the flow of execution and provide better control to the programmer on the flow of execution. They are useful to write better and complex programs.
6 .
What are the programming constructs?
a) Sequential
b) Selection -- if and switch statements
c) Iteration -- for loop, while loop and do-while loop
7 .
Out of do…while and while – which loop is efficient?
In a do…while loop the statements are executed without testing the condition, the first time. From the second time the condition is observed. This means that the programmer does not have control right from the beginning of its execution. In a while loop, the condition is tested first and then only the statements are executed. 

This means it provides better control right from the beginning. Hence, while loop is more efficient than do…while loop.

8 .
Why goto statements are not available in java?
goto statements lead to confusion for a programmer. Especially, in a large program, if several goto statements are used, the programmer would be perplexed while understanding the flow from where to where the control is jumping.
9 .
What is the difference between return and System.exit(0)?
return statement is used inside a method to come out of it. System.exit(0) is used in any method to come out of the program. 
10 .
What is the difference between System.exit(0) and System.exit(1)?
System.exit(0) terminates the program normally, whereas System.exit(1) terminates the program because of some error encountered in the program.