1

I was going throught a huge java project and I came across this line in a file.I am new to java and don't know what this means.Or more specifically

Should I look at PSStreamer.java OR Client.java to see the methods and member variables of the below object.

protected static PSStreamer.Client packetClient = null;
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
liv2hak
  • 14,472
  • 53
  • 157
  • 270

3 Answers3

4

This is what's being declared:

protected            // protected visibility modifier
static               // a class (static) member
PSStreamer.Client    // Client is an inner class of PSStreamer
packetClient = null; // variable name, null initial value

You should look inside PSStreamer to find the inner class Client, and that's where you'll find the attributes and methods of packetClient.

Óscar López
  • 232,561
  • 37
  • 312
  • 386
2

That is a static inner class.

It would look like this: (in PSStreamer.java):

class PSStreamer {
    ...
    static class Client {
        ...
    }
}
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

That is a static nested class. It should be defined in the source code as

public class PSStreamer {

  public static class Client {
    // ..
  }
  // ..
}

So, you should be looking inside PSStreamer.java. Read more about Nested Classes.

Nested classes that are declared static are simply called static nested classes. Non-static nested classes are called inner classes.

Also, take a look at this SO link: Java inner class and static nested class

Community
  • 1
  • 1
Ravi K Thapliyal
  • 51,095
  • 9
  • 76
  • 89