hi, im very very new to java, i have a uni assignment where im using a server and 2 clients to play a game of tennis over a network. i need to add movement in the y axis to the bats. the x coordinate is already being sent using writeint(), then its being picked up by readint(). the function that uses readint() is checking whether this data is an x coord of the mouse or if its ordering a new ball, or if the game is done.

so in the client

		  public void mouseMoved(MouseEvent ev) {
          try {
            output.writeInt(ev.getX());
          } catch(IOException ex) {
            ex.printStackTrace();
          }
		  }

and also

        public void mouseClicked(MouseEvent ev) {
          try {
            output.writeInt(NEWBALL);
          } catch(IOException ex) {
            ex.printStackTrace();
          }
        }

and in the server its picked up as

  public void run()   { //Thread method repeatedly waits for input from client
    try {                         // a racquet x-coord or a message indicating
      while (!done) {             // NEWBALL or game DONE
        int n = input.readInt();
        if (n >= 0 && n < server.getCtWdth()) {
          racPosX = n;
          server.notifyRacPos();
        }
        else if (n == server.NEWBALL)
          server.newBall(this);
        else if (n == server.DONE)
          server.shutdown();
      }
      connection.close();
    }

my question is how can i best achieve sending a second int with the y coord data? can i simply add another writeint() straight after the writeint() for x coord, then add another readint() straight after the readint() for the xcoord, or do i need to add both ints to a string then use a scanner to read it back in?