Biblioteca Java - Rev 4

Subversion Repositories:
Rev:
package inroducere.java.operator;

/**
 * The following program exemplify the use of unary operators.
 *
 */

class UnaryDemo {

    public static void main(String[] args){
         int result = +1; // result is now 1
         System.out.println(result);
         result--;  // result is now 0
         System.out.println(result);
         result++; // result is now 1
         System.out.println(result);
         result = -result; // result is now -1
         System.out.println(result);
         boolean success = false;
         System.out.println(success); // false
         System.out.println(!success); // true
    }
}