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
  • 837,282
  • 173
  • 1,862
  • 1,933
liv2hak
  • 13,641
  • 48
  • 139
  • 250

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
  • 225,348
  • 35
  • 301
  • 374
2

That is a static inner class.

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

class PSStreamer {
    ...
    static class Client {
        ...
    }
}
SLaks
  • 837,282
  • 173
  • 1,862
  • 1,933
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
  • 49,621
  • 9
  • 73
  • 89