Boolean literals are the source code representation for boolean values. : boolean « Java Source And Data Type « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Java Source And Data Type » boolean 
1.12.1.Boolean literals are the source code representation for boolean values.
boolean value can only be defined as true or false

public class MainClass{
    public static void main(String[] argv){

        boolean t = true;  // Legal
        boolean  f = 0;    // Compiler error!

        System.out.println();

    }
}
Type mismatch: cannot convert from int to boolean
1.12.boolean
1.12.1.Boolean literals are the source code representation for boolean values.
1.12.2.The only valid literals of boolean type are true and false.
1.12.3.The default value of a boolean is false.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.