Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
Java Code
BLACK OP
Just wondering can anyone shed any light on this for me and how to do it .
Create a Java Program called Bools using eclipse or any IDE
Declare 2 Boolean variables b1 and b2, one value true and other false
Output these values
Declare a third Boolean variable b3 and set it to be the reverse of value of true Boolean variable
Output reversed variable
Use an expression to set value of Boolean b3 equal to b1 OR b2 (logical OR)
Output b3
Use the parseBoolean method to input a String value (either true or false)and translates it into a
real Boolean b4.
Output b3 AND b4 (logical AND)
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
mad turnip
have you read anything on java before?
TrueDub
Show us what you've done so far & we'll help. We won't do it for you though.
gaelicyoda
Sounds suspiciously like a class 101 assignment
mad turnip
gaelicyoda
wrote:
»
Sounds suspiciously like a class 101 assignment
That was my first thought XD
BLACK OP
Its the part to variable b3 and set it to be the reverse of value of true Boolean variable .Does this mean its just set as fales
BLACK OP
sorry did not ask the question right
BLACK OP
public class Bools {
public static void main(String[] args) {
/*
* boolean is simple Java type which can have only of two values; true or false.
* All rational expressions retrun this type of value.
*
* Declare boolean varibale as below
*
* boolean <variable name> = <default value>;
*
* here assigning default value is optional.
*/
boolean b1 = true;
boolean b2 = false;
boolean b3 = false;
System.out.println("Value of bools variable b1 is :" + b1);
System.out.println("Value of bools variable b2 is :" + b2);
System.out.println("Value of bools variable b3 is :" + b3);
}
}
/*
Output would be
Value of boolean variable b1 is :true
Value of boolean variable b2 is :false
Value of boolean variable b3 is :false
*/
BLACK OP
is this right with this park of the question Declare a third Boolean variable b3 and set it to be the reverse of value of true Boolean variable
[Rasta]
To set the b3 as inverse of b1, you can use the ! operator.
mad turnip
so for a code example it would be
b3 = !b1;
BLACK OP
Ah thanks new i was not seeing it