boolean operators
operators
/** * @author ranadheer * */ public class javaoperators { /** * @param args */ public static void main(String[] args) { { int i=100; int j= 200; int aNumber=1; byte someNumber= 0; /** * The operators are < (lessa than ) * >greater than * <= less than or equal to * >= greater than or equal to * * != not equal * * ++ operator * += * == * -= * -- operators */ //less than demo //operaor < less than if( 99 < i) { System.out.println("99 is less than " + i); } //operator greater than if(j>i){ System.out.println(j+ " is greater than " + i); } // operator equals == if( aNumber == 1) { System.out.println(aNumber +" anumber is equal to one"); } // -- ++ // abc-- is equal to abc-1 int abc =7; System.out.println( abc-- );// prints ? System.out.println( abc ); int bcd=0; System.out.println(--bcd); System.out.println(bcd); if(bcd != 100) { System.out.println("BCD IS NOT EQUAL TO 100"); } System.out.println( bcd ); int cde = 0; cde += 1; //cde += 1; is equal cde +1 System.out.println(cde); } } } output program / 9 is less than 100 200 is greater than 100 1 anumber is equal to one 7 6 -1 -1 BCD IS NOT EQUAL TO 100 -1 1
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/