The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

help with dataoutputstream

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.

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?