Java Operators and Assignments 5 Min Drill

  • The +, - shows positive and negative nature of a expression where as ++ , -- modifies the value of an expression by adding or subtracting.
  • The ! Operator inverts the value of a boolean expression, where as ~ operator inverts the value of an integral type.
  • The sift operators are << un-signed left shift, >> signed right shift and >>> un-signed right shift.
  • The = operator sets a value of a variable or an expression where as == operator compares two object references are pointing to same object or not.
  • The instance of operator is used to find out the run time type identification, i.e. which object belongs to which class instance.
  • Strings are immutable, once assigned values it cannot be changed. If you try change it returns a new String object.
  • The String Buffer class gives flexibility to manipulate the strings.
  • A wrapper class is nothing but a class that encapsulates a single immutable value.
  • All the wrapper classes throws "NumberFormatException" except boolean.
  • The short circuit operators && and || provide logical AND and OR operations on boolean types.
  • The main difference between & and && and between | and || is that the right hand side operand may not be evaluated.