Wednesday 3 June 2015

Bitwise and Logical operators in Java, Jump Statements

^ is the bitwise xor operator
>>>> is the shift right zero fill

(cond1 & cond2 & cond3)
in the above statment we have used the logical AND, will evaluate every condition and then perform the logical AND.

(cond1 && cond2 && cond3)
this is the short circuit AND, will stop if a false condition is found in between.

The result will be same in both cases, and the same expressions can done for logical OR and short circuit logical

The choice of taking & as logical or bitwise is dependent on the operands.
a&b, a and b are int then & is bitwise
a&b, a and b are boolean then & is logical

Jump statments:
return
continue
break

If a source file contains a public class, the class name must be the name of the public class. A source file can only have one public class.

obj1=obj2:
now both objects will have the same memory addressand from there onwards, obj1 and obj2 will effect the same variables.

No comments:

Post a Comment