User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,760 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 340 | Replies: 2 | Solved
Reply
Join Date: Aug 2007
Location: Cherryville, NC
Posts: 34
Reputation: Dio1080 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Dio1080's Avatar
Dio1080 Dio1080 is offline Offline
Light Poster

Help Need help with a method

  #1  
Dec 4th, 2007
can anybody see anything worng?

I'm returning these to the main
sO=ScoreO(O);
sX=ScoreX(X);

These are my two methods:
[java]
//method to tally the score for x
public static int ScoreX(boolean X){

int scoreX=0;

if(X==true){
scoreX+=1;
}
return scoreX;
}
//method to tally the score for x

public static int ScoreO(boolean O){

int scoreO=0;

if (O== true){
scoreO+=1;
}

return scoreO;
}


}
[/java]
What is wrong, because I can't figure it out...
Last edited by Dio1080 : Dec 4th, 2007 at 1:00 am. Reason: BB code wont work
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,508
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: Need help with a method

  #2  
Dec 4th, 2007
It might help to know what you expect, and what you get, as well as any errors that are occurring. But, thing, if you are passing a boolean already then the == is redundant. Simply do

Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Aug 2007
Location: Cherryville, NC
Posts: 34
Reputation: Dio1080 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Dio1080's Avatar
Dio1080 Dio1080 is offline Offline
Light Poster

Re: Need help with a method

  #3  
Dec 4th, 2007
solved it, things for the help thought
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 9:25 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC