Friday, May 30, 2008

Tutorial: Declaring Boolean Variables

Tutorial: Declaring Boolean Variables

Now let's write a Visual Basic project based on the snippet of code. In this tutorial, you will have a chance to declare three boolean variables and assign them different values.

Load the Developer Studio and close the project workspace you created. Then open a new text file and type the following code into the text Editor Window.

public static void main (String arv[] {
// Declare the boolean.
boolean myBol1;

// Declare and assign the value to false.
boolean myBool2 = false

// Declare and assign the value to true,
boolean myBool3 = true ;

//Assign the first to false
myBool = false;

//Print out values
System.out.printIn ("the value if my Bool1 is " + myBool1);
System.out.printIn ("the value if my Bool2 is " + myBool2);
System.out.printIn ("the value if my Bool3 is " + myBool3);

}
}

No comments: