aspose file tools*
The moose likes Beginning Java and the fly likes How do I use 1 boolean statement for 2 variables ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I use 1 boolean statement for 2 variables ?" Watch "How do I use 1 boolean statement for 2 variables ?" New topic
Author

How do I use 1 boolean statement for 2 variables ?

WeiJie Lim
Ranch Hand

Joined: Sep 05, 2012
Posts: 91
I am trying to code a boolean statement to check if the year stored in the following variables is a leap year or not. I remembered being able to use only 1 boolean statement for this, but I forgotten how I did it =/

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

If you don't want to repeat the whole statement each time, you can ofcourse write a method that contains the statement, and call the method instead of repeating the whole statement.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
wood burning stoves
 
subject: How do I use 1 boolean statement for 2 variables ?