Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

client-server relationship  RSS feed

 
Olliver Lim Kam Sian
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone
need some help about invoking method from a seperate .java file! well I this code which is about a guessing random numbers:


I tried to use System.load(name) but couldn't get it to work,well I don't know if its the right one to be honest.

Thanks for considerig my problem

Olliver


EDIT by mw: Added Code Tags for formatting.
[ September 28, 2007: Message edited by: marc weber ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're just trying to call getGame() from GameTest, all you need to do is use your "game" reference...

game.getGame();

Unless these files are on different machines, you don't really have a networking issue here (e.g., client/server).
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: Methods named "getX()" are called "getter" methods, and they return ("get") X. So it might be confusing to name your method "getGame()" when it is not returning an instance of Game. Instead, you might change the name to something like playGame().
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!