Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29120 > unrolled thread

Help with paper, rock, scissors game

Started byscottwd01@gmail.com
First post2014-07-18 23:35 -0700
Last post2014-07-19 02:51 -0700
Articles 18 — 9 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Help with paper, rock, scissors game scottwd01@gmail.com - 2014-07-18 23:35 -0700
    Re: Help with paper, rock, scissors game leif.roar@invalid.com (Leif Roar Moldskred) - 2014-07-19 02:19 -0500
      Re: Help with paper, rock, scissors game scottwd01@gmail.com - 2014-07-19 00:34 -0700
        Re: Help with paper, rock, scissors game leif.roar@invalid.com (Leif Roar Moldskred) - 2014-07-19 03:49 -0500
    Re: Help with paper, rock, scissors game lipska the kat <lipskathekat@example.com> - 2014-07-19 08:39 +0100
      Re: Help with paper, rock, scissors game scottwd01@gmail.com - 2014-07-19 22:38 -0700
        Re: Help with paper, rock, scissors game markspace <markspace@nospam.nospam> - 2014-07-19 23:12 -0700
          Re: Help with paper, rock, scissors game Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-20 10:49 +0000
            Re: Help with paper, rock, scissors game scottwd01@gmail.com - 2014-07-20 18:37 -0700
              Re: Help with paper, rock, scissors game scottwd01@gmail.com - 2014-07-20 18:47 -0700
                Re: Help with paper, rock, scissors game Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-21 12:01 +0000
                  Re: Help with paper, rock, scissors game ĵess stone <jess.st0ne@gmail.com> - 2014-07-21 21:59 +0000
                    Re: Help with paper, rock, scissors game Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-21 22:22 +0000
                      Re: Help with paper, rock, scissors game ĵess stone <jess.st0ne@gmail.com> - 2014-07-21 22:35 +0000
                      Re: Help with paper, rock, scissors game "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-22 13:56 +0100
          Re: Help with paper, rock, scissors game lipska the kat <lipskathekat@example.com> - 2014-07-20 12:29 +0100
            Re: Help with paper, rock, scissors game Scott Dunning <scottwd01@gmail.com> - 2014-07-20 20:10 -0700
    Re: Help with paper, rock, scissors game Roedy Green <see_website@mindprod.com.invalid> - 2014-07-19 02:51 -0700

#29120 — Help with paper, rock, scissors game

Fromscottwd01@gmail.com
Date2014-07-18 23:35 -0700
SubjectHelp with paper, rock, scissors game
Message-ID<ad9edd21-86dd-4476-bf07-822ee29796a2@googlegroups.com>
Hello,

I have a couple quick questions.  FYI, I am taking a class in college and it's beginning Java and this is only my second week, so I'm super new.  Hopefully this is the correct place to post my java related questions.  If not, if you could point me in the right direction I'd appreciate it.  If so, here are my questions.  


I had a paper rock, scissors game as an assignment that was due a couple days ago.  I ended up having to submit an not working file but, I'd like to figure out what I'm doing wrong for future assignments.  

I feel like it's correct and I got it down to just one error (reached end of file while parsing).  I think that means that it needs an extra } at the end, but if I add one I go from one to 17 errors.  I'm thinking maybe there is something wrong with my while loop or how I created a new function (or method in java, I had a class in python last semester so I'm not 100% sure I got the functions in java down yet).   What makes sense to me and how I understand it is, the function itself must be created outside of main, but actually called in main?  Also, are all of the functions going to be in the class RPS_Game?  We haven't really learned classes yet this is just my second week.  

Here is my code, any help is greatly appreciated!  



import java.util.Random;
import java.util.Scanner;

public class RPS_Game
{
 public static void main(String[] args)
 {

//Variables  
     char player1, player2;
     char r = R;
     char p = P;
     char s = S;
     int winner, p1Score, p2Score, playCount;
 //Setting the p1 and p2 and playCount equal to 0. 
     p1Score = p2Score = playCount = 0;


     Scanner scan = new Scanner(System.in);

  //Start of while loop that asks p1 and p2 for R,P or S.    
     while (playCount < 3);
     {
     System.out.print("Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: ");
     player1 = scan.nextLine() .toUpperCase() .charAt(0);

     System.out.print("Player 2: Please enter either (R)ock, (P)aper, or (S)cissors: ");
     player2 = scan.nextLine().toUpperCase() .charAt(0);        

 //Add one to the playCount   
     playCount ++;

//Calling the winningPlayer function    
     int winner = winningPlayer(player1, player2);

     if (winner = 0) {
         System.out.println("Tie! Nobody wins.");
     } 
     else if (winner = 1) {
         System.out.println("Player 1 wins!");  
         p1Score ++;
      }   
     else if (winner = 2) {
         System.out.println("Player 2 wins");
         p2Score ++;
      }

     System.out.println("\nScores after this play:\nPlayer 1:" + p1score + "\nPlayer 2:" + p2Score + "\nThanks for playing!");      
     }
 }  



//Defining the winningPlayer function that decides which player wins or if there is a tie.    
 public static int winningPlayer(char player1, char player2)
 {

     if (player1 == "P") {
         if (player2 == "P")
             return 0;
         else if (player2 == "R")
             return 1;
         else 
             return 2 ;
     } 
     else if (player1 == "R") {
         if (player2 == "R")
             return 0;
         else if (player2 == "S")
             return 1;
         else 
             return 2;            
     } 
     else if (player1 == "S") {
         if (player2 == "S")
             return 0;
         else if (player2 == "P")
             return 1;
         else 
             return 2 ;
   }     
}

[toc] | [next] | [standalone]


#29121

Fromleif.roar@invalid.com (Leif Roar Moldskred)
Date2014-07-19 02:19 -0500
Message-ID<TPqdnSOT7IVphlfOnZ2dnUVZ8tadnZ2d@giganews.com>
In reply to#29120
scottwd01@gmail.com wrote:
> 
>
> I feel like it's correct and I got it down to just one error
>  (reached end of file while parsing).  I think that means that it
>  needs an extra } at the end, but if I add one I go from one to 17
>  errors.  I'm thinking maybe there is something wrong with my while
>  loop or how I created a new function (or method in java, I had a
>  class in python last semester so I'm not 100% sure I got the
>  functions in java down yet).  What makes sense to me and how I
>  understand it is, the function itself must be created outside of
>  main, but actually called in main?  Also, are all of the functions
>  going to be in the class RPS_Game?  We haven't really learned
>  classes yet this is just my second week.


The overall gist of your program is right, but you have a number
of syntax errors so that you get 17 errors when you add the missing
close bracket is not unexpected.

One tip, particularly when you start out, is to label your close
bracket -- like this:

public class Example {
  public static void main( String[] args ) {
    if( 1 > 2 ) {

    } // end if -- mathematical impossibility
    else {

    } // end else -- mathematical certainity: always happens
  } // end main()
} // end class Example


I've not got a java compiler at hand, so I might overlook
a few errors, but here's what I've eyeballed of errors:

>     char r = R;
>     char p = P;
>     char s = S;

This bit is wrong. Just R, P and S without any quotation marks around
them would be a reference to _variables_ namend R, P and S, and as
these don't exist the program will complainq. When you mean the
_character_ R, you need to enclose it in single quotes like this:

  char r = 'R';

Of course, as you don't use the variables r, p or s anywhere in the
program, you don't actually need these three lines at all.

> 
>  //Start of while loop that asks p1 and p2 for R,P or S.    
>     while (playCount < 3);

This bit is wrong -- the semicolon marks an end of the while loop,
and the following open bracket then starts a block of code that has
nothing to do with the while. basically, you've written this:

  while( playCount < 3 ) {
    /* Do nothing */
  }
 
  {
     System.out.print("Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: ");
     player1 = scan.nextLine() .toUpperCase() .charAt(0);
     ...
  }

As playCount is never incremented inside the while loop, the loop
will never exit but run forever.
 
> //Defining the winningPlayer function that decides which player wins or if there is a tie.    
> public static int winningPlayer(char player1, char player2)
> {
> 
>     if (player1 == "P") {
>         if (player2 == "P")
>             return 0;
>         else if (player2 == "R")
>             return 1;
>         else 
>             return 2 ;
>     } 

Here you have used the wrong quotation marks. In some languages, both single and double
quotation marks can be used to enclose strings -- in Java there's a difference. Double
quotation marks enclose strings, and single quotation marks enclose chars. Since player1
and player2 are variables of type char, you need to use single quotation marks here:

 if( player1 == 'P' ) {
   ...
 } 

>     else if (player1 == "R") {
>         if (player2 == "R")
>             return 0;
>         else if (player2 == "S")
>             return 1;
>         else 
>             return 2;            
>     } 
>     else if (player1 == "S") {
>         if (player2 == "S")
>             return 0;
>         else if (player2 == "P")
>             return 1;
>         else 
>             return 2 ;
>   } // [1]    
> } // [2]

Now, the close bracket I've annotated with [1] closes the last "else if" and the
one I've annotated with [2] closes the method, so you need one more to close the
class.

Additionaly, as written, the scoring method has a problem in that it doesn't
return a value for every possibile case, so that won't compile. If player1
enters something besides 'P', 'R' or 'S' you'll "skip over" the if, the
first else if and the second else if, and hit the end of the method where 
there's no return statement.

You'll want to either throw an exception or return an error value at that
point. (If you choose to return an error value you should check for that
value in the main method.)

Hope this helps.


P.S. You might get some posters here who will complain about the style
of your code (how it's formatted and how it looks rather than what it
does.) Don't worry about that -- right now you should focus on getting
the code to do what you want it to do. Programming style is important
later, but right now it'll just be one more thing to confuse you.

[toc] | [prev] | [next] | [standalone]


#29122

Fromscottwd01@gmail.com
Date2014-07-19 00:34 -0700
Message-ID<3f072f43-2b61-4521-8e9f-9c406dfb8dd9@googlegroups.com>
In reply to#29121
On Saturday, July 19, 2014 12:19:16 AM UTC-7, Leif Roar Moldskred wrote:
> scott wrote:
> 
> > 
> 
> >
> 
> > I feel like it's correct and I got it down to just one error
> 
> >  (reached end of file while parsing).  I think that means that it
> 
> >  needs an extra } at the end, but if I add one I go from one to 17
> 
> >  errors.  I'm thinking maybe there is something wrong with my while
> 
> >  loop or how I created a new function (or method in java, I had a
> 
> >  class in python last semester so I'm not 100% sure I got the
> 
> >  functions in java down yet).  What makes sense to me and how I
> 
> >  understand it is, the function itself must be created outside of
> 
> >  main, but actually called in main?  Also, are all of the functions
> 
> >  going to be in the class RPS_Game?  We haven't really learned
> 
> >  classes yet this is just my second week.
> 
> 
> 
> 
> 
> The overall gist of your program is right, but you have a number
> 
> of syntax errors so that you get 17 errors when you add the missing
> 
> close bracket is not unexpected.
> 
> 
> 
> One tip, particularly when you start out, is to label your close
> 
> bracket -- like this:
> 
> 
> 
> public class Example {
> 
>   public static void main( String[] args ) {
> 
>     if( 1 > 2 ) {
> 
> 
> 
>     } // end if -- mathematical impossibility
> 
>     else {
> 
> 
> 
>     } // end else -- mathematical certainity: always happens
> 
>   } // end main()
> 
> } // end class Example
> 
> 
> 
> 
> 
> I've not got a java compiler at hand, so I might overlook
> 
> a few errors, but here's what I've eyeballed of errors:
> 
> 
> 
> >     char r = R;
> 
> >     char p = P;
> 
> >     char s = S;
> 
> 
> 
> This bit is wrong. Just R, P and S without any quotation marks around
> 
> them would be a reference to _variables_ namend R, P and S, and as
> 
> these don't exist the program will complainq. When you mean the
> 
> _character_ R, you need to enclose it in single quotes like this:
> 
> 
> 
>   char r = 'R';
> 
> 
> 
> Of course, as you don't use the variables r, p or s anywhere in the
> 
> program, you don't actually need these three lines at all.
> 
> 
> 
> > 
> 
> >  //Start of while loop that asks p1 and p2 for R,P or S.    
> 
> >     while (playCount < 3);
> 
> 
> 
> This bit is wrong -- the semicolon marks an end of the while loop,
> 
> and the following open bracket then starts a block of code that has
> 
> nothing to do with the while. basically, you've written this:
> 
> 
> 
>   while( playCount < 3 ) {
> 
>     /* Do nothing */
> 
>   }
> 
>  
> 
>   {
> 
>      System.out.print("Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: ");
> 
>      player1 = scan.nextLine() .toUpperCase() .charAt(0);
> 
>      ...
> 
>   }
> 
> 
> 
> As playCount is never incremented inside the while loop, the loop
> 
> will never exit but run forever.
> 
>  
> 
> > //Defining the winningPlayer function that decides which player wins or if there is a tie.    
> 
> > public static int winningPlayer(char player1, char player2)
> 
> > {
> 
> > 
> 
> >     if (player1 == "P") {
> 
> >         if (player2 == "P")
> 
> >             return 0;
> 
> >         else if (player2 == "R")
> 
> >             return 1;
> 
> >         else 
> 
> >             return 2 ;
> 
> >     } 
> 
> 
> 
> Here you have used the wrong quotation marks. In some languages, both single and double
> 
> quotation marks can be used to enclose strings -- in Java there's a difference. Double
> 
> quotation marks enclose strings, and single quotation marks enclose chars. Since player1
> 
> and player2 are variables of type char, you need to use single quotation marks here:
> 
> 
> 
>  if( player1 == 'P' ) {
> 
>    ...
> 
>  } 
> 
> 
> 
> >     else if (player1 == "R") {
> 
> >         if (player2 == "R")
> 
> >             return 0;
> 
> >         else if (player2 == "S")
> 
> >             return 1;
> 
> >         else 
> 
> >             return 2;            
> 
> >     } 
> 
> >     else if (player1 == "S") {
> 
> >         if (player2 == "S")
> 
> >             return 0;
> 
> >         else if (player2 == "P")
> 
> >             return 1;
> 
> >         else 
> 
> >             return 2 ;
> 
> >   } // [1]    
> 
> > } // [2]
> 
> 
> 
> Now, the close bracket I've annotated with [1] closes the last "else if" and the
> 
> one I've annotated with [2] closes the method, so you need one more to close the
> 
> class.
> 
> 
> 
> Additionaly, as written, the scoring method has a problem in that it doesn't
> 
> return a value for every possibile case, so that won't compile. If player1
> 
> enters something besides 'P', 'R' or 'S' you'll "skip over" the if, the
> 
> first else if and the second else if, and hit the end of the method where 
> 
> there's no return statement.
> 
> 
> 
> You'll want to either throw an exception or return an error value at that
> 
> point. (If you choose to return an error value you should check for that
> 
> value in the main method.)
> 
> 
> 
> Hope this helps.
> 
> 
> 
> 
> 
> P.S. You might get some posters here who will complain about the style
> 
> of your code (how it's formatted and how it looks rather than what it
> 
> does.) Don't worry about that -- right now you should focus on getting
> 
> the code to do what you want it to do. Programming style is important
> 
> later, but right now it'll just be one more thing to confuse you.

Wow, thanks Lief!!  You've helped a ton!  You've given me a lot to go over so I'm gonna go back and try and implement your suggestions.   

As for my formatting, I'm sure it's a mess, but I'm only three days into this class and I totally agree, I need the help with getting the code to actually work first.  I appreciate that you explained things to not just gave me answers.  I got a bunch of nasty responses on another forum and zero help so I really appreciate yours.  

P.S.  Is this a good forum for these type of questions?  

Scott

[toc] | [prev] | [next] | [standalone]


#29124

Fromleif.roar@invalid.com (Leif Roar Moldskred)
Date2014-07-19 03:49 -0500
Message-ID<lr6dnbxFeKearFfOnZ2dnUVZ7sOdnZ2d@giganews.com>
In reply to#29122
scottwd01@gmail.com wrote:
>
> P.S.  Is this a good forum for these type of questions?  
> 

Conditionally, I'd say yes. There is another newsgroup,
comp.lang.java.help, that used to be the right group, but I don't know
if there's any life left in it these days. You probably should try
that one first, but there's not so much traffic here these days that I
think anyone would be upset with the odd beginner's question here, as
long as it's as well formulated and complete as yours were and as long
as it's of the "help me understand" kind rather than "please give me
the answer."

Just be aware that the answers might sometimes turn nit-picky and
sometimes veer into esoteric discussions that are not directly related
to your question at all. (Basically: it's Usenet.)

-- 
Leif Roar Moldskred

[toc] | [prev] | [next] | [standalone]


#29123

Fromlipska the kat <lipskathekat@example.com>
Date2014-07-19 08:39 +0100
Message-ID<bK6dnRhyD_JdvVfOnZ2dnUVZ7qqdnZ2d@bt.com>
In reply to#29120
On 19/07/14 07:35, scottwd01@gmail.com wrote:
> Hello,
>
> I have a couple quick questions.  FYI, I am taking a class in college and it's beginning Java and this is only my second week, so I'm super new.  Hopefully this is the correct place to post my java related questions.  If not, if you could point me in the right direction I'd appreciate it.  If so, here are my questions.

It is :-)
>
> I had a paper rock, scissors game as an assignment that was due a couple days ago.
> I ended up having to submit an not working file but, I'd like to figure out what I'm doing wrong for future
 > assignments.
>
> I feel like it's correct

It isn't :-(

> and I got it down to just one error (reached end of file while parsing).
> I think that means that it needs an extra } at the end, but if I add one I go from one to 17 errors.  I'm thinking maybe there is something wrong with my while loop or how I created a new function (or method in java, I had a class in python last semester so I'm not 100% sure I got the functions in java down yet).   What makes sense to me and how I understand it is, the function itself must be created outside of main, but actually called in main?  Also, are all of the functions going to be in the class RPS_Game?  We haven't really learned classes yet this is just my second week.
>
> Here is my code, any help is greatly appreciated!

OK

The best way to approach this is to show you some code that compiles
There are a number of problems I have highlighted with a /* */ comment 
block.

Have a look at the code and see if you can compile it
then try and understand the changes

Please note I have only checked if this compiles and starts up
I have NOT checked it for game correctness.

Are you using an IDE or a text editor and the command line?

/* compiles and runs */

import java.util.Random; /* not required but does not cause an error */
import java.util.Scanner;

public class RPS_game{
	
  public static void main(String[] args){

	 //Variables
      char player1, player2;

      /* These should be characters not Strings */
      char r = 'R';
      char p = 'P';
      char s = 'S';

      int winner, p1Score, p2Score, playCount;
      //Setting the p1 and p2 and playCount equal to 0.
      p1Score = p2Score = playCount = 0;

      Scanner scan = new Scanner(System.in);

      //Start of while loop that asks p1 and p2 for R,P or S.
      while (playCount < 3) /* no semicolon */
      {
	     System.out.print("Player 1: Please enter either (R)ock, (P)aper, 
or (S)cissors: ");
	     player1 = scan.nextLine() .toUpperCase() .charAt(0);
	
	     System.out.print("Player 2: Please enter either (R)ock, (P)aper, 
or (S)cissors: ");
	     player2 = scan.nextLine().toUpperCase() .charAt(0);

		 //Add one to the playCount
		     playCount ++;
		
		  //Calling the winningPlayer function
	     winner = winningPlayer(player1, player2);
	
	     /* should be == not = */
	     if (winner == 0) {
	         System.out.println("Tie! Nobody wins.");
	     }
	     else if (winner == 1) {
	         System.out.println("Player 1 wins!");
	         p1Score ++;
	      }
	     else if (winner == 2) {
	         System.out.println("Player 2 wins");
	         p2Score ++;
	      }                                                       /* 
uppercase S in p1Score*/
	     System.out.println("\nScores after this play:\nPlayer 1:" + 
p1Score + "\nPlayer 2:" + p2Score + "\nThanks for playing!");
      }
  }



	//Defining the winningPlayer function that decides which player wins or 
if there is a tie.
	public static int winningPlayer(char player1, char player2){
		
	     /* explicit result to return */
		 int result = 0;
		
		 /* should be characters not Strings */
	     if (player1 == 'P') {
	         if (player2 == 'P')
	             result = 0;
	         else if (player2 == 'R')
	        	 result = 1;
	         else
	        	 result = 2 ;
	     }
	     else if (player1 == 'R') {
	         if (player2 == 'R')
	        	 result = 0;
	         else if (player2 == 'S')
	        	 result = 1;
	         else
	             result = 2;
	     }
	     else if (player1 == 'S') {
	         if (player2 == 'S')
	        	 result = 0;
	         else if (player2 == 'P')
	        	 result = 1;
	         else
	        	 result = 2 ;
	   }
	   return result;
	}
} /* need a final } */


/* end */



> import java.util.Random;
> import java.util.Scanner;
>
> public class RPS_Game
> {
>   public static void main(String[] args)
>   {
>
> //Variables
>       char player1, player2;
>       char r = R;
>       char p = P;
>       char s = S;
>       int winner, p1Score, p2Score, playCount;
>   //Setting the p1 and p2 and playCount equal to 0.
>       p1Score = p2Score = playCount = 0;
>
>
>       Scanner scan = new Scanner(System.in);
>
>    //Start of while loop that asks p1 and p2 for R,P or S.
>       while (playCount < 3);
>       {
>       System.out.print("Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: ");
>       player1 = scan.nextLine() .toUpperCase() .charAt(0);
>
>       System.out.print("Player 2: Please enter either (R)ock, (P)aper, or (S)cissors: ");
>       player2 = scan.nextLine().toUpperCase() .charAt(0);
>
>   //Add one to the playCount
>       playCount ++;
>
> //Calling the winningPlayer function
>       int winner = winningPlayer(player1, player2);
>
>       if (winner = 0) {
>           System.out.println("Tie! Nobody wins.");
>       }
>       else if (winner = 1) {
>           System.out.println("Player 1 wins!");
>           p1Score ++;
>        }
>       else if (winner = 2) {
>           System.out.println("Player 2 wins");
>           p2Score ++;
>        }
>
>       System.out.println("\nScores after this play:\nPlayer 1:" + p1score + "\nPlayer 2:" + p2Score + "\nThanks for playing!");
>       }
>   }
>
>
>
> //Defining the winningPlayer function that decides which player wins or if there is a tie.
>   public static int winningPlayer(char player1, char player2)
>   {
>
>       if (player1 == "P") {
>           if (player2 == "P")
>               return 0;
>           else if (player2 == "R")
>               return 1;
>           else
>               return 2 ;
>       }
>       else if (player1 == "R") {
>           if (player2 == "R")
>               return 0;
>           else if (player2 == "S")
>               return 1;
>           else
>               return 2;
>       }
>       else if (player1 == "S") {
>           if (player2 == "S")
>               return 0;
>           else if (player2 == "P")
>               return 1;
>           else
>               return 2 ;
>     }
> }
>


-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#29131

Fromscottwd01@gmail.com
Date2014-07-19 22:38 -0700
Message-ID<33990a2f-f59c-434f-9db4-6713e31f4c05@googlegroups.com>
In reply to#29123
On Saturday, July 19, 2014 12:39:43 AM UTC-7, lipska the kat wrote:
> On 19/07/14 07:35, scottwd01@gmail.com wrote:
> 
> > Hello,
> 
> >
> 
> > I have a couple quick questions.  FYI, I am taking a class in college and it's beginning Java and this is only my second week, so I'm super new.  Hopefully this is the correct place to post my java related questions.  If not, if you could point me in the right direction I'd appreciate it.  If so, here are my questions.
> 
> 
> 
> It is :-)
> 
> >
> 
> > I had a paper rock, scissors game as an assignment that was due a couple days ago.
> 
> > I ended up having to submit an not working file but, I'd like to figure out what I'm doing wrong for future
> 
>  > assignments.
> 
> >
> 
> > I feel like it's correct
> 
> 
> 
> It isn't :-(
> 
> 
> 
> > and I got it down to just one error (reached end of file while parsing).
> 
> > I think that means that it needs an extra } at the end, but if I add one I go from one to 17 errors.  I'm thinking maybe there is something wrong with my while loop or how I created a new function (or method in java, I had a class in python last semester so I'm not 100% sure I got the functions in java down yet).   What makes sense to me and how I understand it is, the function itself must be created outside of main, but actually called in main?  Also, are all of the functions going to be in the class RPS_Game?  We haven't really learned classes yet this is just my second week.
> 
> >
> 
> > Here is my code, any help is greatly appreciated!
> 
> 
> 
> OK
> 
> 
> 
> The best way to approach this is to show you some code that compiles
> 
> There are a number of problems I have highlighted with a /* */ comment 
> 
> block.
> 
> 
> 
> Have a look at the code and see if you can compile it
> 
> then try and understand the changes
> 
> 
> 
> Please note I have only checked if this compiles and starts up
> 
> I have NOT checked it for game correctness.
> 
> 
> 
> Are you using an IDE or a text editor and the command line?
> 
> 
> 
> /* compiles and runs */
> 
> 
> 
> import java.util.Random; /* not required but does not cause an error */
> 
> import java.util.Scanner;
> 
> 
> 
> public class RPS_game{
> 
> 	
> 
>   public static void main(String[] args){
> 
> 
> 
> 	 //Variables
> 
>       char player1, player2;
> 
> 
> 
>       /* These should be characters not Strings */
> 
>       char r = 'R';
> 
>       char p = 'P';
> 
>       char s = 'S';
> 
> 
> 
>       int winner, p1Score, p2Score, playCount;
> 
>       //Setting the p1 and p2 and playCount equal to 0.
> 
>       p1Score = p2Score = playCount = 0;
> 
> 
> 
>       Scanner scan = new Scanner(System.in);
> 
> 
> 
>       //Start of while loop that asks p1 and p2 for R,P or S.
> 
>       while (playCount < 3) /* no semicolon */
> 
>       {
> 
> 	     System.out.print("Player 1: Please enter either (R)ock, (P)aper, 
> 
> or (S)cissors: ");
> 
> 	     player1 = scan.nextLine() .toUpperCase() .charAt(0);
> 
> 	
> 
> 	     System.out.print("Player 2: Please enter either (R)ock, (P)aper, 
> 
> or (S)cissors: ");
> 
> 	     player2 = scan.nextLine().toUpperCase() .charAt(0);
> 
> 
> 
> 		 //Add one to the playCount
> 
> 		     playCount ++;
> 
> 		
> 
> 		  //Calling the winningPlayer function
> 
> 	     winner = winningPlayer(player1, player2);
> 
> 	
> 
> 	     /* should be == not = */
> 
> 	     if (winner == 0) {
> 
> 	         System.out.println("Tie! Nobody wins.");
> 
> 	     }
> 
> 	     else if (winner == 1) {
> 
> 	         System.out.println("Player 1 wins!");
> 
> 	         p1Score ++;
> 
> 	      }
> 
> 	     else if (winner == 2) {
> 
> 	         System.out.println("Player 2 wins");
> 
> 	         p2Score ++;
> 
> 	      }                                                       /* 
> 
> uppercase S in p1Score*/
> 
> 	     System.out.println("\nScores after this play:\nPlayer 1:" + 
> 
> p1Score + "\nPlayer 2:" + p2Score + "\nThanks for playing!");
> 
>       }
> 
>   }
> 
> 
> 
> 
> 
> 
> 
> 	//Defining the winningPlayer function that decides which player wins or 
> 
> if there is a tie.
> 
> 	public static int winningPlayer(char player1, char player2){
> 
> 		
> 
> 	     /* explicit result to return */
> 
> 		 int result = 0;
> 
> 		
> 
> 		 /* should be characters not Strings */
> 
> 	     if (player1 == 'P') {
> 
> 	         if (player2 == 'P')
> 
> 	             result = 0;
> 
> 	         else if (player2 == 'R')
> 
> 	        	 result = 1;
> 
> 	         else
> 
> 	        	 result = 2 ;
> 
> 	     }
> 
> 	     else if (player1 == 'R') {
> 
> 	         if (player2 == 'R')
> 
> 	        	 result = 0;
> 
> 	         else if (player2 == 'S')
> 
> 	        	 result = 1;
> 
> 	         else
> 
> 	             result = 2;
> 
> 	     }
> 
> 	     else if (player1 == 'S') {
> 
> 	         if (player2 == 'S')
> 
> 	        	 result = 0;
> 
> 	         else if (player2 == 'P')
> 
> 	        	 result = 1;
> 
> 	         else
> 
> 	        	 result = 2 ;
> 
> 	   }
> 
> 	   return result;
> 
> 	}
> 
> } /* need a final } */
> 
> 
> 
> 
> 
> /* end */
> 
> 
> 
> 
> 
> 
> 
> > import java.util.Random;
> 
> > import java.util.Scanner;
> 
> >
> 
> > public class RPS_Game
> 
> > {
> 
> >   public static void main(String[] args)
> 
> >   {
> 
> >
> 
> > //Variables
> 
> >       char player1, player2;
> 
> >       char r = R;
> 
> >       char p = P;
> 
> >       char s = S;
> 
> >       int winner, p1Score, p2Score, playCount;
> 
> >   //Setting the p1 and p2 and playCount equal to 0.
> 
> >       p1Score = p2Score = playCount = 0;
> 
> >
> 
> >
> 
> >       Scanner scan = new Scanner(System.in);
> 
> >
> 
> >    //Start of while loop that asks p1 and p2 for R,P or S.
> 
> >       while (playCount < 3);
> 
> >       {
> 
> >       System.out.print("Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: ");
> 
> >       player1 = scan.nextLine() .toUpperCase() .charAt(0);
> 
> >
> 
> >       System.out.print("Player 2: Please enter either (R)ock, (P)aper, or (S)cissors: ");
> 
> >       player2 = scan.nextLine().toUpperCase() .charAt(0);
> 
> >
> 
> >   //Add one to the playCount
> 
> >       playCount ++;
> 
> >
> 
> > //Calling the winningPlayer function
> 
> >       int winner = winningPlayer(player1, player2);
> 
> >
> 
> >       if (winner = 0) {
> 
> >           System.out.println("Tie! Nobody wins.");
> 
> >       }
> 
> >       else if (winner = 1) {
> 
> >           System.out.println("Player 1 wins!");
> 
> >           p1Score ++;
> 
> >        }
> 
> >       else if (winner = 2) {
> 
> >           System.out.println("Player 2 wins");
> 
> >           p2Score ++;
> 
> >        }
> 
> >
> 
> >       System.out.println("\nScores after this play:\nPlayer 1:" + p1score + "\nPlayer 2:" + p2Score + "\nThanks for playing!");
> 
> >       }
> 
> >   }
> 
> >
> 
> >
> 
> >
> 
> > //Defining the winningPlayer function that decides which player wins or if there is a tie.
> 
> >   public static int winningPlayer(char player1, char player2)
> 
> >   {
> 
> >
> 
> >       if (player1 == "P") {
> 
> >           if (player2 == "P")
> 
> >               return 0;
> 
> >           else if (player2 == "R")
> 
> >               return 1;
> 
> >           else
> 
> >               return 2 ;
> 
> >       }
> 
> >       else if (player1 == "R") {
> 
> >           if (player2 == "R")
> 
> >               return 0;
> 
> >           else if (player2 == "S")
> 
> >               return 1;
> 
> >           else
> 
> >               return 2;
> 
> >       }
> 
> >       else if (player1 == "S") {
> 
> >           if (player2 == "S")
> 
> >               return 0;
> 
> >           else if (player2 == "P")
> 
> >               return 1;
> 
> >           else
> 
> >               return 2 ;
> 
> >     }
> 
> > }
> 
> >
> 
> 
> 
> 
> 
> -- 
> 
> lipska the kat - treacherous feline.
> 
> Proudly nominated for IPOTY 2014 - LIGAF
> 
> GNU/Linux user #560883 - linuxcounter.net

Lipska, Lief, Roedy, you are all awesome!  You've helped me learn a lot and I REALLY appreciate you taking the time to explain things to me!  I have a another quick question.  Are you using google groups to post and reply?  That's what I'm using and it seems to be a bit of a mess and a little confusing.  I belong to a python mailing list that I was able to get through my email.  Is that something I can do with the comp.lang.java?   

Thanks again!!

[toc] | [prev] | [next] | [standalone]


#29132

Frommarkspace <markspace@nospam.nospam>
Date2014-07-19 23:12 -0700
Message-ID<lqfmkb$irl$1@dont-email.me>
In reply to#29131
On 7/19/2014 10:38 PM, scottwd01@gmail.com wrote:

> I have a another quick question.  Are you using google groups to
> post and reply?  That's what I'm using and it seems to be a bit of a
> mess and a little confusing.


I use Thunderbird, which is an email reader, but it also has a 
newsreader built in.  I use the eternal-september.org news server to 
read and post to the groups.

https://www.mozilla.org/en-US/thunderbird

Google groups are indeed a bit crap, I'd steer away from them if possible.

[toc] | [prev] | [next] | [standalone]


#29133

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2014-07-20 10:49 +0000
Message-ID<lqg6r8$58n$1@dont-email.me>
In reply to#29132
On Sat, 19 Jul 2014 23:12:23 -0700, markspace wrote:

> On 7/19/2014 10:38 PM, scottwd01@gmail.com wrote:
> 
>> I have a another quick question.  Are you using google groups to post
>> and reply?  That's what I'm using and it seems to be a bit of a mess
>> and a little confusing.
> 
> 
> I use Thunderbird, which is an email reader, but it also has a
> newsreader built in.  I use the eternal-september.org news server to
> read and post to the groups.
> 
> https://www.mozilla.org/en-US/thunderbird
> 
> Google groups are indeed a bit crap, I'd steer away from them if
> possible.

I agree with markspace about using a newsreader and avoiding google 
groups. Here are some other newsreaders to try:

Back when I was a Windows user, the best newsreader I found was Forte's 
Agent http://www.forteinc.com/ , which formerly had free and paid-for 
versions. Now its just a 30 day free trial, but should still be good 
value at $30.

Or, you could try XPN, http://xpn.altervista.org/index-en.html , which is 
written in Python and is available as both source and Windows binary 
downloads.
 
These days I use Pan. Its useless unless you're running Linux, but is a 
standard package for most mainstream distros.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#29140

Fromscottwd01@gmail.com
Date2014-07-20 18:37 -0700
Message-ID<11b809de-5b61-44de-9971-5c8db172467a@googlegroups.com>
In reply to#29133
On Sunday, July 20, 2014 3:49:13 AM UTC-7, Martin Gregorie wrote:
> On Sat, 19 Jul 2014 23:12:23 -0700, markspace wrote:
> 
> 
> 
> > On 7/19/2014 10:38 PM, scottwd01@gmail.com wrote:
> 
> > 
> 
> >> I have a another quick question.  Are you using google groups to post
> 
> >> and reply?  That's what I'm using and it seems to be a bit of a mess
> 
> >> and a little confusing.
> 
> > 
> 
> > 
> 
> > I use Thunderbird, which is an email reader, but it also has a
> 
> > newsreader built in.  I use the eternal-september.org news server to
> 
> > read and post to the groups.
> 
> > 
> 
> > https://www.mozilla.org/en-US/thunderbird
> 
> > 
> 
> > Google groups are indeed a bit crap, I'd steer away from them if
> 
> > possible.
> 
> 
> 
> I agree with markspace about using a newsreader and avoiding google 
> 
> groups. Here are some other newsreaders to try:
> 
> 
> 
> Back when I was a Windows user, the best newsreader I found was Forte's 
> 
> Agent http://www.forteinc.com/ , which formerly had free and paid-for 
> 
> versions. Now its just a 30 day free trial, but should still be good 
> 
> value at $30.
> 
> 
> 
> Or, you could try XPN, http://xpn.altervista.org/index-en.html , which is 
> 
> written in Python and is available as both source and Windows binary 
> 
> downloads.
> 
>  
> 
> These days I use Pan. Its useless unless you're running Linux, but is a 
> 
> standard package for most mainstream distros.
> 
> 
> 
> 
> 
> -- 
> 
> martin@   | Martin Gregorie
> 
> gregorie. | Essex, UK
> 
> org       |

Thanks for the suggestions!  I already have thunderbird installed, I've just always used the regular mac mail app.  I have a prob stupid question.  I kind of stubbled into the comp.lang.java, it's a newsfeed kind of like a forum?  As apposed to a mailing list.  I belong to a python mailing list and was looking for something similar when I found this.  If that was stupid this question most definitely will be haha.  I don't understand what eternal-september.org is?  Do I use thunderbird to get the eternal-september.org news server, which then finds the comp.lang.java forum?  Any suggestions on how to hook it up in thunderbird?

[toc] | [prev] | [next] | [standalone]


#29141

Fromscottwd01@gmail.com
Date2014-07-20 18:47 -0700
Message-ID<ac154357-e615-4a39-970a-5a8a10e30b93@googlegroups.com>
In reply to#29140
On Sunday, July 20, 2014 6:37:39 PM UTC-7, scot...@gmail.com wrote:
> On Sunday, July 20, 2014 3:49:13 AM UTC-7, Martin Gregorie wrote:
> 
> > On Sat, 19 Jul 2014 23:12:23 -0700, markspace wrote:
> 
> > 
> 
> > 
> 
> > 
> 
> > > On 7/19/2014 10:38 PM, scottwd01@gmail.com wrote:
> 
> > 
> 
> > > 
> 
> > 
> 
> > >> I have a another quick question.  Are you using google groups to post
> 
> > 
> 
> > >> and reply?  That's what I'm using and it seems to be a bit of a mess
> 
> > 
> 
> > >> and a little confusing.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > I use Thunderbird, which is an email reader, but it also has a
> 
> > 
> 
> > > newsreader built in.  I use the eternal-september.org news server to
> 
> > 
> 
> > > read and post to the groups.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > https://www.mozilla.org/en-US/thunderbird
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Google groups are indeed a bit crap, I'd steer away from them if
> 
> > 
> 
> > > possible.
> 
> > 
> 
> > 
> 
> > 
> 
> > I agree with markspace about using a newsreader and avoiding google 
> 
> > 
> 
> > groups. Here are some other newsreaders to try:
> 
> > 
> 
> > 
> 
> > 
> 
> > Back when I was a Windows user, the best newsreader I found was Forte's 
> 
> > 
> 
> > Agent http://www.forteinc.com/ , which formerly had free and paid-for 
> 
> > 
> 
> > versions. Now its just a 30 day free trial, but should still be good 
> 
> > 
> 
> > value at $30.
> 
> > 
> 
> > 
> 
> > 
> 
> > Or, you could try XPN, http://xpn.altervista.org/index-en.html , which is 
> 
> > 
> 
> > written in Python and is available as both source and Windows binary 
> 
> > 
> 
> > downloads.
> 
> > 
> 
> >  
> 
> > 
> 
> > These days I use Pan. Its useless unless you're running Linux, but is a 
> 
> > 
> 
> > standard package for most mainstream distros.
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > martin@   | Martin Gregorie
> 
> > 
> 
> > gregorie. | Essex, UK
> 
> > 
> 
> > org       |
> 
> 
> 
> Thanks for the suggestions!  I already have thunderbird installed, I've just always used the regular mac mail app.  I have a prob stupid question.  I kind of stubbled into the comp.lang.java, it's a newsfeed kind of like a forum?  As apposed to a mailing list.  I belong to a python mailing list and was looking for something similar when I found this.  If that was stupid this question most definitely will be haha.  I don't understand what eternal-september.org is?  Do I use thunderbird to get the eternal-september.org news server, which then finds the comp.lang.java forum?  Any suggestions on how to hook it up in thunderbird?

So, if I go to set up other account, I can set up a newsgroup account, is that correct?  If so when it asks for the news group server do I enter comp.lang.java?  And last question, where does the eternal-september.org come into play?  Thanks again!!

[toc] | [prev] | [next] | [standalone]


#29152

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2014-07-21 12:01 +0000
Message-ID<lqivf1$es9$1@dont-email.me>
In reply to#29141
On Sun, 20 Jul 2014 18:47:23 -0700, scottwd01 wrote:

> So, if I go to set up other account, I can set up a newsgroup account,
> is that correct?  If so when it asks for the news group server do I
> enter comp.lang.java?  And last question, where does the
> eternal-september.org come into play?  Thanks again!!
>
The basics
==========
The NNTP (news group system) is a network of news servers. Each server 
holds a list of newsgroups it is prepared to support along with copies of 
current messages in each newsgroup. Messages are exchanged between news 
servers so that eventually each server has a complete message collection 
for each newsgroup it supports. So, by connecting your news client 
program to any server you get access to all the messages in any newsgroup 
it supports. Once your client is configured to use a particular news 
server, you can subscribe to any or all if the newsgroups it supports. 
When to start the client, it pulls down all the new messages for each 
subscribed news group so you can read, and maybe reply, to messages. You 
can set an message expiry period on your client, which causes it to 
discard any messages that are older than this.

Specifics:
==========
eternal-september.org is a news server. Configure thunderbird to use it, 
which gives access to the 25,000 or so newsgroups. Pick those of 
interest, e.g. comp.lang.java.programmed, and subscribe to them. This 
causes the current messages to be downloaded so you can read them. 

You can post replies to the newsgroup, which lets everybody see your 
reply, or you can reply privately by e-mail. 

Each newsgroup has its own etiquette: this one doesn't encourage private 
replies, frowns on posting abuse and generally expects you to have used a 
web search before asking about something you could easily have found out 
by searching. 

There is a fuller explanation here: 
https://en.wikipedia.org/wiki/Usenet_newsgroup


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#29169

Fromĵess stone <jess.st0ne@gmail.com>
Date2014-07-21 21:59 +0000
Message-ID<lqk2g0$5da$1@speranza.aioe.org>
In reply to#29152
In article lqivf1$es9$1@dont-email.me, Martin Gregorie said...

> Each newsgroup has its own etiquette: this one doesn't encourage private
> replies, frowns on posting abuse and generally expects you to have used
> a web search before asking about something you could easily have found
> out by searching.

Caveat: that only applies if it's obvious, without hindsight, that you 
can easily find out by searching. So, when there's an obvious, fairly 
specific search to use, that one can expect will produce only relevant 
results. Not if all you have to go on is three letters, say, or if 
someone says "mugwumps" and a search for "mugwumps" wouldn't tell you 
much (perhaps because there's six or seven different things called 
"mugwumps" rather than just one), and though a search for "cloverfish" 
would, someone who didn't already know this stuff would have no reason to 
think to search for "cloverfish" to find out about "mugwumps".

[toc] | [prev] | [next] | [standalone]


#29170

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2014-07-21 22:22 +0000
Message-ID<lqk3s1$j73$1@dont-email.me>
In reply to#29169
On Mon, 21 Jul 2014 21:59:28 +0000, ĵess stone wrote:

> In article lqivf1$es9$1@dont-email.me, Martin Gregorie said...
> 
>> Each newsgroup has its own etiquette: this one doesn't encourage
>> private replies, frowns on posting abuse and generally expects you to
>> have used a web search before asking about something you could easily
>> have found out by searching.
> 
> Caveat: that only applies if it's obvious, without hindsight, that you
> can easily find out by searching. So, when there's an obvious, fairly
> specific search to use, that one can expect will produce only relevant
> results. Not if all you have to go on is three letters, say, or if
> someone says "mugwumps" and a search for "mugwumps" wouldn't tell you
> much (perhaps because there's six or seven different things called
> "mugwumps" rather than just one), and though a search for "cloverfish"
> would, someone who didn't already know this stuff would have no reason
> to think to search for "cloverfish" to find out about "mugwumps".

Don't read all that carefully, do you? Ponder the meaning of "something 
you could easily have found out by searching" and reconsider your caveat.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#29173

Fromĵess stone <jess.st0ne@gmail.com>
Date2014-07-21 22:35 +0000
Message-ID<lqk4ji$9sk$1@speranza.aioe.org>
In reply to#29170
In article lqk3s1$j73$1@dont-email.me, Martin Gregorie said...

>> Caveat: that only applies if it's obvious, without hindsight, that you
>> can easily find out by searching.
> 
> [insult deleted], do you?

None of the nasty things that you have said or implied about me are at 
all true.

> Ponder [rest of rude demand deleted].

Go fuck yourself.

[toc] | [prev] | [next] | [standalone]


#29191

From"Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org>
Date2014-07-22 13:56 +0100
Message-ID<U-adnbdPD4U7wlPOnZ2dnUVZ8hKdnZ2d@bt.com>
In reply to#29170
Martin Gregorie wrote:

> > Caveat: that only applies if it's obvious, without hindsight, that you
> > can easily find out by searching. So, when there's an obvious, fairly
> > specific search to use, [...].
>
> Don't read all that carefully, do you? Ponder the meaning of "something
> you could easily have found out by searching" and reconsider your caveat.

More than that, I think.  Skill in using the Net to find information is now a 
vital part of every professional programmer's toolkit (I say "every" but I 
admit there may be some exceptions).  Nobody expects beginners to have that 
skill -- searching for, /and identifying/, reliable technical information is a 
skill in itself which is not (as far as I know) taught, and doesn't (as far as 
I know) come all that naturally (I've watched many Net-generation people search 
for technical stuff and make a mess of it).

It's no shame to encourage a beginner to practise a skill s/he will be 
dependent on for the foreseeable future.

OTOH, practise does need some sort of confirmation -- I can easily practise 
spotting which of the people I see around me are really space aliens, members 
of MI6, whatever.  But without confirmation I can't get better at it.  So 
/only/ saying "use Google" is also less helpful than it could be.

So -- IMO -- one good template for answers might be:
    Here are the basics, ...  For more information, look for search terms like
    xxx, yyy.  You may have to filter out references to zzz since that's a
    completely different topic.

    -- chris 

[toc] | [prev] | [next] | [standalone]


#29134

Fromlipska the kat <lipskathekat@example.com>
Date2014-07-20 12:29 +0100
Message-ID<LeudnStqINWWNVbOnZ2dnUVZ7tudnZ2d@bt.com>
In reply to#29132
On 20/07/14 07:12, markspace wrote:
> On 7/19/2014 10:38 PM, scottwd01@gmail.com wrote:
>
>> I have a another quick question.  Are you using google groups to
>> post and reply?  That's what I'm using and it seems to be a bit of a
>> mess and a little confusing.
>
>
> I use Thunderbird, which is an email reader, but it also has a
> newsreader built in.  I use the eternal-september.org news server to
> read and post to the groups.
>
> https://www.mozilla.org/en-US/thunderbird
>
> Google groups are indeed a bit crap, I'd steer away from them if possibl

Concur. Thunderbird and eternal-september are a good solution if your 
ISP has a crap on non existent news feed.

-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#29142

FromScott Dunning <scottwd01@gmail.com>
Date2014-07-20 20:10 -0700
Message-ID<53CC84B2.3020604@gmail.com>
In reply to#29134
On 7/20/14, 4:29 AM, lipska the kat wrote:
Nevermind, I figured out how to get it working in Thunderbird.  Thanks 
for the suggestions and all of the help!!

SCott

[toc] | [prev] | [next] | [standalone]


#29126

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-07-19 02:51 -0700
Message-ID<erfks9tav1gubsqdjcb6qjpdu4o9rgdn40@4ax.com>
In reply to#29120
On Fri, 18 Jul 2014 23:35:00 -0700 (PDT), scottwd01@gmail.com wrote,
quoted or indirectly quoted someone who said :

>Here is my code, any help is greatly appreciated! =20

you need to trace and watch your code executing line by line.  The
errors will then become obvious.

For that you need an ide.

see http://mindprod.com/jgloss/ide.html

I use IntelliJ.  Eclipse and Netbeans are also popular.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Science is what we understand well enough to explain to a computer.
Art is everything else we do. 
~ Donald Ervin Knuth (born: 1938-01-10 age: 76)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web