0

I am trying to make a program that determines whether a statement is true or false

I have this so far:

public static void main(String[] args)
	{
		int w=2,x=3,y=4,z=5;
		boolean expression;
		expression = (w<=x)&&(z>=y); 
		if(expression == true);
			System.out.println("true");
		if(expression == false);
			System.out.println("false");
		
	}

...but all it prints out is true and false

any help?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by progr
1

Made this change:

public static void main(String[] args)
	{
		int w=2,x=3,y=4,z=5;
		boolean expression;
		expression = (w<=x)&&(z>=y); 
		if(expression == true)
			System.out.println("true");
		if(expression == false)
			System.out.println("false");
		
	}

move the ";" after if(.....)

Hope it helps

0

Made this change:

public static void main(String[] args)
	{
		int w=2,x=3,y=4,z=5;
		boolean expression;
		expression = (w<=x)&&(z>=y); 
		if(expression == true)
			System.out.println("true");
		if(expression == false)
			System.out.println("false");
		
	}

move the ";" after if(.....)

Hope it helps

thanks man, its always something simple i miss...duh

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.