Results 1 to 3 of 3
Thread: use of static keyword
- 06-18-2009, 11:12 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 16
- Rep Power
- 0
- 06-18-2009, 11:48 PM #2
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 5
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 BoyoIf the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
- 06-25-2009, 07:53 AM #3
check out this notes i found in the internet. might be helpful
Java: Static/Class methodsWe Learn Through Mistakes..,
Manfizy:rolleyes:
Similar Threads
-
non-static member can not be referenced from a static context
By christina in forum New To JavaReplies: 3Last Post: 03-20-2009, 12:35 AM -
Non-Static method in static context error
By wizmang in forum New To JavaReplies: 4Last Post: 04-24-2008, 08:51 AM -
Explicit static initialization with the static clause
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 11:07 PM -
Error: Non-static method append(char) cannot be referenced from a static context
By paul in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:05 AM -
Error: non-static variable height cannot be referenced from a static context at line
By fernando in forum AWT / SwingReplies: 1Last Post: 08-01-2007, 09:25 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks