how some method are called without object in java and without static

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
aakash447
Posts: 14
Joined: 07 Jan 2020, 06:21

how some method are called without object in java and without static

Post by aakash447 »

Code: Select all

public class TeenPattiGameThread extends TeenPattiGameLogic implements Runnable {

Code: Select all

if ((!gameStatus.isGameStarted()) && (gameExtn.getParentRoom().getPlayersList().size() < gameStatus.getMinPlayers())) {
      -->    removeGhostUser(nextGamePlayers, players, spectatorsWithSeat, spectators, waitingListPlayers, gameStatus, gameExtn);
            }
while removeGhostUser method is in CommonGameLogic class
which is just an import in TeenPattiGameThread
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: how some method are called without object in java and without static

Post by Lapo »

Hi,
this is code you have written, so you should now better than us :)

There's only two main cases where you can call a method without specifying an object:

1) the method is part of the inheritance chain (i.e. it is part of one of the parent interfaces/classes)
2) the method was imported statically using the "import static" directive

If you're using any Java IDE (Eclipse, IntelliJ etc...) you should be able to figure it out pretty easily.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
aakash447
Posts: 14
Joined: 07 Jan 2020, 06:21

Re: how some method are called without object in java and without static

Post by aakash447 »

Ya , the method was accessed due to the chain of extends.
Thank You
Post Reply