Results 1 to 5 of 5
Thread: Compile Issue
- 05-14-2008, 03:43 PM #1
Member
- Join Date
- May 2008
- Posts
- 9
- Rep Power
- 0
Compile Issue
Im having a compiler issue. It keeps asking for a ';' but I have all of them accounted for as far as I know, and I have all the brackets arranged nicely and such and I still cannot see the problem. Heres my code, if I posted the code wrong I apologize.
also I should note before I forget...the specific problem lies in the Run method, and points to the line "for (control.gameOver());"
Java Code:import java.net.*; import java.io.*; public class Player extends Thread { private Socket connection; private DataInputStream input; private DataOutputStream output; private TicTacToeServer control; private int number; private char mark; protected boolean threadSuspended = true; public Player(Socket s, TicTacToeServer t, int num) { mark = (num == 0 ? 'X' : 'O'); connection = s; try { input = new DataInputStream (connection.getInputStream()); output = new DataOutputStream (connection.getOutputStream()); }/*end try*/ catch (IOException e) { e.printStackTrace(); System.exit(1); }//end catch control = t; number = num; }//end Player public void otherPlayerMoved(int loc) { try { output.writeUTF("Opponent moved"); output.writeInt(loc); }/*end try*/ catch (IOException e) {e.printStackTrace(); }//end catch }//end otherPlayMoved public void run() { int done = false; try { control.display("Player" + (number ==0 ? 'X' : 'O') + "Connected"); output.writeChar(mark); output.writeUTF("Player" + (number == 0? "X connected\n" : "O connecteded\n")); if(mark == 'X') { output.writeUTF("Waiting for another opponent..."); try { synchronized(this) { while(threadSuspended) wait(); }//end synch }/*end try*/ catch(InterruptedException e) { e.printStackTrace(); }//end catch output.writeUTF("Other player connected....time to play the game"); }//end IF while(!done) { int location = input.readInt(); if(control.validMove(location, number)) { control.display("loc" + location); output.writeUTF("Valid move"); }//end if else output.writeUTF("nope"); for (control.gameOver()); done = true; }//end while connection.close(); }/*end try*/ catch (IOException e) { e.printStackTrace(); System.exit(1); }//end catch }//end Run }//end Player class
- 05-14-2008, 05:02 PM #2
1st thing:
Java Code:public void run() { int done = false;
you cannot assign boolean value to integer.
2nd:
you need to post the code of TicTacToeServer ;)i am the future
- 05-14-2008, 08:23 PM #3
Member
- Join Date
- May 2008
- Posts
- 9
- Rep Power
- 0
I had changed it...oh well I mustve posted it before I saved it? Cuz I had a copy on my flash and on the desktop. Hold on, if need be Il post the server class also
- 05-14-2008, 08:29 PM #4
D:D
whatever it is, but at the end, the game is i like the way you write :cool:i am the future
- 05-14-2008, 08:51 PM #5
Member
- Join Date
- May 2008
- Posts
- 9
- Rep Power
- 0
Alright so IM doing some tinkering with it, correcting it all. Yeah I had posted the saved version of that file -_- lol. So in my efforts to convert the necessary parameters and what not to ints I have come across an illegal start of expression error. What u posted before about the whole boolean and int conflict. How would I change that so the variable returns an int, cuz obv IM doing it wrong for some reason....lol
Similar Threads
-
doesn't compile?!
By jon80 in forum New To JavaReplies: 8Last Post: 06-14-2008, 05:42 PM -
JFormattedTextField Issue
By teracomp in forum AWT / SwingReplies: 1Last Post: 01-21-2008, 06:55 PM -
Not able to compile
By bugger in forum New To JavaReplies: 2Last Post: 01-09-2008, 10:13 PM -
Issue
By chaitu444 in forum New To JavaReplies: 2Last Post: 11-06-2007, 07:49 PM -
compilation issue
By orchid in forum EclipseReplies: 2Last Post: 04-20-2007, 12:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks