File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ public class Precedence {
2+ public static void main (String [] args ) {
3+ /* Operators Precedence */
4+ int a = ~8 ;
5+ System .out .println (a );
6+
7+ char ch ='D' ;
8+ int result = (Character .isLowerCase (ch )) ? 1 : (Character .isUpperCase (ch )) ? 0 : -1 ;
9+ System .out .println (result );
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ public class Unary {
2+ public static void main (String [] args ) {
3+
4+ int a = 10 ;
5+
6+ // In unary Operator = 1. Pre-Increment or Decrement, 2. Post-Increment or Decrement
7+
8+ // Pre Increment ++a
9+ int b = ++a ; // b = a = a + 1 -> a=11;
10+
11+ // Pre Decrement --a
12+ int c = --a ; // a=10;
13+
14+ // Post Increment a++
15+ int d = a ++; // a=11 'd' use the first value of 'a' means 10 after processing it a = a+1
16+
17+ // Post Decrement a--
18+ int e = a --; // a=10 e=a=11
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments