Results 1 to 2 of 2

Thread: Java

  1. #1
    parimalakr is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default Java

    Hi,

    I'm new to Java.Can u Please tell me how many times "static method" will get execute in program.

    Thanks

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    4

    Default

    what.... Depends on how many static methods your create....

    Static methods use no instance variables of any object of the class they are defined in. If you define a method to be static, you will be given a rude message by the compiler if you try to access any instance variables. You can access static variables, but except for constants, this is unusual. Static methods typically take all they data from parameters and compute something from those parameters, with no reference to variables. This is typical of methods which do some kind of generic calculation. A good example of this are the many utility methods in the predefined Math class. (See Math and java.util.Random).
    read this

    http://leepoint.net/JavaBasics/metho...20-define.html
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

Posting Permissions

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