物件導向程式設計

 

 

      2.11 Boolean數

 

 


授課教師:陳慶瀚

WWW : http://www.miat.ee.isu.edu.tw/java

E-mail : pierre@isu.edu.tw   

 


Booleans are named after George Boole, a nineteenth century logician. Each boolean variable has one of two values, true or false. These are not the same as the Strings "true" and "false". They are not the same as any numeric value like 1 or 0. They are simply true and false. Booleans are not numbers; they are not Strings. They are simply booleans.

Boolean variables are declared just like any other variable.

    boolean test1 = true;
    boolean test2 = false; 
    
Note that true and false are reserved words in Java. These are called the Boolean literals. They are case sensitive. True with a capital T is not the same as true with a little t. The same is true of False and false.

 


 

物件導向程式設計

義守大學電機系 陳慶瀚

2001.10.02