hi all,
i have doubt about using static key word.
what is the use of static keyword rather than
it is used to call methods without creating object
to that static class.
can any one answer this question.
Printable View
hi all,
i have doubt about using static key word.
what is the use of static keyword rather than
it is used to call methods without creating object
to that static class.
can any one answer this question.
static means that the method/variable/class(inner classes only) can be accessed without creating an instance of the class containing the static method/variable/class. Because of this, static methods may not access non-static methods/variables/classes. Static methods usually provide some function for handling an object (changing a string, reading something from a string (in wrapper classes) etc.) Static variables are usually used as arguments to methods. Static classes are mainly used when a static method needs an inner class. If the inner class was not static, the method would be unable to use it.
Singing Boyo
check out this notes i found in the internet. might be helpful
Java: Static/Class methods