ok, first of all, do you understand what the static keyword means? If
so, skip the following.
Static means that the class, method, or variable may be called even if
an instance of that c/m/v has not been created.
Next, you must understand that you can string member/method calls
together. When this is done, the objects on the right are made more
specific by those on the left. For example, assume we have the
following class:
class A{
private int i, j;
public int getI(){return i;}
public int setI(int x){return i = x;}
}
if we have the following code
static void main(){
A a = new A();
a.j = 0;
a.setI(3);
System.out,println(a.getI());
}
What is being done?
1) create a new instance of class A called 'a'
2) set the j member of 'a' to 0;
3) call the setI() method of 'a' and pass in the value 3
4) this is complicated, let's work this from the inside out.
First, a.getI() calls the getI function of 'a' and returns the value of i.
Now let's look at System.out.println().
-System is indeed a class.
-out is a static PrintStream object. As you might guess, it's used to
print a stream of characters. Since it is static, it doesnt need to be
created in your program.
-println() is a member of the PrintStream class.
So, the line System.out.println() calls the println() method of the
static member out of the System class. We can do this because out is a
static member of System and so does not need any instantiation.
Did this help at all?