Results 1 to 3 of 3
  1. #1
    venkatallu is offline Member
    Join Date
    Sep 2008
    Rep Power

    Default use of static keyword

    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.

  2. #2
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Rep Power


    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
    If 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!

  3. #3
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Rep Power


    check out this notes i found in the internet. might be helpful
    Java: Static/Class methods
    We Learn Through Mistakes..,

Similar Threads

  1. Replies: 3
    Last Post: 03-20-2009, 01:35 AM
  2. Non-Static method in static context error
    By wizmang in forum New To Java
    Replies: 4
    Last Post: 04-24-2008, 08:51 AM
  3. Replies: 0
    Last Post: 04-16-2008, 11:07 PM
  4. Replies: 1
    Last Post: 08-07-2007, 05:05 AM
  5. Replies: 1
    Last Post: 08-01-2007, 09:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts