Java Programming

Topics: Computer, Java, Operating system Pages: 37 (7002 words) Published: September 5, 2013
-------------------------------------------------
int a = 10;
-------------------------------------------------
int b = 20;
-------------------------------------------------
int c = 25;
-------------------------------------------------
int d = 25;
-------------------------------------------------
Result:
-------------------------------------------------
a + b = 30a - b = -10a * b = 200b / a = 2
-------------------------------------------------
b % a = 0c % a = 5a++ = 10b-- = 11
-------------------------------------------------
d++ = 25++d = 27

-------------------------------------------------
int a = 10;
-------------------------------------------------
int b = 20;
-------------------------------------------------
Result:
-------------------------------------------------
a == b = falsea != b = truea > b = falsea < b = true -------------------------------------------------
b >= a = trueb <= a = false

-------------------------------------------------
int a = 60;/* 60 = 0011 1100 */
-------------------------------------------------
int b = 13;/* 13 = 0000 1101 */
-------------------------------------------------
int c = 0;
-------------------------------------------------

-------------------------------------------------
c = a & b; /* 12 = 0000 1100 */
-------------------------------------------------
c = a | b; /* 61 = 0011 1101 */
-------------------------------------------------
c = a ^ b; /* 49 = 0011 0001 */
-------------------------------------------------
c = ~a; /*-61 = 1100 0011 */
-------------------------------------------------
c = a << 2; /* 240 = 1111 0000 */
-------------------------------------------------
c = a >> 2; /* 215 = 1111 */
-------------------------------------------------
c = a >>> 2; /* 215 = 0000 1111 */
-------------------------------------------------
Result:
-------------------------------------------------
a & b = 12a | b = 61a ^ b = 49a = -61
-------------------------------------------------
a << 2 = 240a >> 15a >>> 15

-------------------------------------------------
boolean a = true;
-------------------------------------------------
boolean b = false;
-------------------------------------------------
System.out.println("a && b = " + (a&&b)); -------------------------------------------------
System.out.println("a || b = " + (a||b) );
-------------------------------------------------
System.out.println("!(a && b) = " + !(a && b)); -------------------------------------------------
Result:
-------------------------------------------------
a && b = falsea || b = true!(a && b) = true

-------------------------------------------------
int a = 10;
-------------------------------------------------
int b = 20;
-------------------------------------------------
int c = 0;
-------------------------------------------------

-------------------------------------------------
c = a + b;
-------------------------------------------------
c += a ;
-------------------------------------------------
c -= a ;
-------------------------------------------------
c *= a ;
-------------------------------------------------

-------------------------------------------------
a = 10;
-------------------------------------------------
c = 15;
-------------------------------------------------
c /= a ;
-------------------------------------------------
a = 10;
-------------------------------------------------
c = 15;
-------------------------------------------------
c %= a ;
-------------------------------------------------
c <<= 2 ;...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Java Ring Essay
  • Essay about Java Programming
  • Essay about Concept of Java Programming
  • JAVA Essay
  • Eclipse and Java for Total Beginners Essay
  • History of Java Programming Essay
  • Essay about Thesis on java
  • Essay on Java Programming

Become a StudyMode Member

Sign Up - It's Free