Java has a built-in data type, boolean, to represent Boolean values. A variable of type boolean can be either true or false. Note that true and false are special literals in Java. The following BooleanDemo program demonstrates using the boolean datatype. Study the BooleanDemo program and try to determine what the output will be.
public class BooleanDemo
{
public static void main(String [] args)
{
boolean t = true;
System.out.println(“t is “ + t);
int x = 10;
boolean y = (x > 15);
System.out.println(“y is “ + y);
// y = x; // Does not compile!
}
}
Boolean Data Type
Wednesday, November 4, 2009
|
digg it
Leave your comment
Posted by Nine Seas
Published in
boolean,
built in data type
Archives
-
▼
2009
(52)
-
►
October
(14)
- Java Run time Environment
- write Java programs
- Technologies in J2EE
- Java 2 Enterprise Edition
- Tools for developing and running Java applications...
- Version of the JDK
- Development tools in SDK
- Installing SDK
- HelloWorld Program
- writing the code for our Java program
- A Simple Java Program
- Help topics for javac
- Identifiers
- Variables
-
►
October
(14)
Categories
- assignment
- binary
- bits
- boolean
- built in data type
- c++
- car accessories
- char
- class
- combined
- compile
- compiler
- component
- criterion
- data type
- decrement
- development tools
- Directv packages
- elegant
- error
- exclusive
- expression
- final
- float
- hidden Objects
- HTML
- increment
- int
- j2ee
- java
- java program
- javac
- javadoc
- jdk
- JRE
- JVM
- least-significant
- likely outcome
- liposuction
- literal
- lunch
- Mac
- math
- menus
- money
- object
- Object oriented
- OOPS
- operands
- operator
- operators
- positive and negative
- problems
- quotes
- reference
- sdk
- shopping
- shopwiki
- Signature
- simple program
- Solaris
- solitaire
- stored
- true or false
- truth table
- types
- types of comment
- types of control flow
- underscore
- unicode
- Unix
- variable


No Responded To This Post
Leave A Reply