my dog learned polymorphism*
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
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: 85
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: 14114
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I use 1 boolean statement for 2 variables ?