I'm just trying to see if I can fully understand the concept of static and the reason of static in a main class. The keyword static refers to the main class. the reason why methods in a main class are static is because the main class does not deal with objects but with the class itself.
However constructors deal with objects and therefore uses non static constructors because objects have unique characteristics and it would not make sense to make them static.
If anyone can see if I made a mistake in my statement or can steer me in the right direction, it would help me a great deal! :)
Not exactly...
static
means the field/method etc belongs to the class, and not to a particular instance of the class. All instances of the class have access to static fields, and there is only one instance of each static field that is shared between instances.The main method must be static, because it is invoked without creating an instance first.
All static methods may be invoked without creating an instance of the class - any methods the main method calls must also be static, unless the main method creates an instance of the class - then instance methods may be invoked on that instance.
STATIC METHOD CALL - When you make a static method call you do not make a lasting change to the data inside of the class/object.
NON-STATIC METHOD CALL - For this type of method call you must "instantiate" the object using the Constructor method (which cannot be static). An object can then be passed around. If your method changes the value of a field/global variable in the class then that value remains the same in that object until someone/something else changes it.
When you instantiate an object you can only "invoke" (call) non-static methods inside that object. Likewise you cannot call static methods from an object you must call it by providing the class name followed by a period followed by the method name.
Static methods can only reference other static content. Non-static can reference both.
From Java Specification (Third edition):
About static fields http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.3.1.1
About static methods http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.3.2
There is no such thing as a main class in Java.
No, it refers to static classes or static class members.
There is no such thing as a main class. The statement is meaningless.
All constructors are 'non-static'. There is no such thing as a static constructor. There is no point in any of this discussion.
I think you need to start again, forgetting about non-existent 'main classes' and 'static constructors'. Basically static methods refer to methods that can be invoked without having an instance of the class. Conversely, constructors create an instance of the class so they can't logically be static.