public static void main(String[] args) {
// Assign a positive or negative value to a number.
int positive = +1;
int negative = -1;
System.out.println("positive = " + positive);
System.out.println("negative = " + negative);
positive = -1;
negative = +1;
System.out.println("\npositive = " + positive);
System.out.println("negative = " + negative);
// Increment and decrement a value.
int result = 5;
result++;
System.out.println("\nif result is set to 5 then result++ = " + result);
result--;
System.out.println("if result is set to 6 then result-- = " + result);
// Change a boolean value with !.
boolean success = false;
System.out.println("\nsuccess = " + success);
System.out.println("success = " + !success);
}
}
No comments:
Post a Comment