Saturday, August 20, 2011

Boolean type in java

//Boolean type in java
class Booleantype
{
 public static void main(String arg[])
    {
       int a=10,b=5,c=5,d=2;
       boolean bool1=a>b&&c>d;
       boolean bool2=a>b&&c<d;
       boolean bool3=a<b||c>d;
       boolean bool4=a<b&&c<d;
       boolean bool5=(a-b==c);
       System.out.println(" a is"+a);
       System.out.println(" b is"+b);
       System.out.println(" c is"+c);
       System.out.println(" d is"+d);
       System.out.println(" a>b&&c>d is "+bool1);
       System.out.println(" a>b&&c<d is "+bool2);
       System.out.println(" a<b||c>d is "+bool3);
       System.out.println(" a<b&&c<d is "+bool4);
       System.out.println(" a-b==c is "+bool5);
    }
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More