Results 1 to 8 of 8
Thread: methods
- 06-02-2011, 04:12 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
methods
really really new to java and im scratching my head where im going wrong and not getting this to work.
I have wrote an instance method that will perform an action if a previously declared variables value is true, if it is false it will not perform the action. Now i can only get it to perform the action if the variable is false and it does nothing when true.
happy is the variable where the true or false value is stored.Java Code:public void cheer() { if(!happy) { this.performAction("cheer"); } }
Thanks for any pointers
- 06-02-2011, 04:20 PM #2
- 06-02-2011, 04:22 PM #3
- 06-02-2011, 04:39 PM #4
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
Yes it turns a true value to false and false to true which is why im getting nowhere with it.
Think i have it
Seems to be doing what i need.Java Code:if(happy && happy)
- 06-02-2011, 05:03 PM #5
Have you tried it with only one happy variable? if (happy)
- 06-02-2011, 05:16 PM #6
The easiest approach would be,
Hope that makes some sense,Java Code:if (happy) { // Do happy things } else { // Do sad things }
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 06-02-2011, 06:25 PM #7
Without code tags...
if (happy) {
___.gif)
} else {
___
}
db
- 06-02-2011, 06:38 PM #8
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
All the methods
By N00Bie in forum New To JavaReplies: 5Last Post: 02-12-2011, 02:18 PM -
methods vs. non methods
By Latanyar in forum New To JavaReplies: 10Last Post: 10-11-2010, 11:46 PM -
Methods
By soccer_kid_6 in forum New To JavaReplies: 3Last Post: 03-02-2010, 12:14 AM -
How to get methods to see variables in other methods
By ejs7597 in forum New To JavaReplies: 4Last Post: 04-03-2009, 06:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks