Either you do it using logical operators or simply return true or false. But declaring a variable that will hold boolean values and manipulating it on whether or not it satisfies the condition would be the best option ( I guess )
You should writeAs for printing out a boolean (or a Boolean) the PrintStream (= System.out.).print and println methods are overloaded to take a boolean argument.
If you prefer the printf methods (which you ought to use whenever possible) you find the %b tag will print a boolean as true or false. You can also use the %B tag which prints TRUE or FALSE! You can find a bit about printf in the Java Tutorials, and there is more detail (but less easy to read) in the Formatter class.
Joined: Oct 13, 2008
Thanks for the correction Ritchie . He can then just add additional equal() methods in the condition.
Joined: Oct 13, 2005
You mean add more boolean values with && or || operators. Of course. What you are returning is (the result of) a plain simple boolean expression.
Obviously if the expression gets long, you would be better to have named boolean variables and put them together with operators, otherwise the expression will become incomprehensible.