Results 1 to 6 of 6
  1. #1
    MarkWilson is offline Member
    Join Date
    Jun 2008
    Location
    us
    Posts
    47
    Rep Power
    0

    Default About static variable

    Hi
    how many times i can declare static variable in my program
    what about --public static void main -- here in every program we are declare main as static . how thy work

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    You can declare as many static fields as you wish (which has nothing to do with a static method, BTW). "how thy work" is that there is only one copy of them that all instances of (and references to) that Class use.

  3. #3
    MarkWilson is offline Member
    Join Date
    Jun 2008
    Location
    us
    Posts
    47
    Rep Power
    0

    Default is Java 100%

    see dear friends ,

    actually java is not 100%pure oo language because of Primitive data types

    and we can use the Wrapper class in java to use Primitive data types

    so as compare with the C++ how u can say that " C++ is object oriented pure and Java is not "

    please maintain some example so ican clear my dought?

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by MarkWilson View Post
    see dear friends ,

    actually java is not 100%pure oo language because of Primitive data types

    and we can use the Wrapper class in java to use Primitive data types

    so as compare with the C++ how u can say that " C++ is object oriented pure and Java is not "

    please maintain some example so ican clear my dought?
    Maybe you meant to post this in a different thread (or maybe start a new one) since it doesn't have anything to do with the rest of it.

    But, in any case, C++ is much less pure than Java, not more. But it is a silly question anyway, as there is no defined "purity" scale for OO anyway, so the question is meaningless.

  5. #5
    MarkWilson is offline Member
    Join Date
    Jun 2008
    Location
    us
    Posts
    47
    Rep Power
    0

    Default

    ya see in single program i am declaring psvm (string args )
    and also using static for some other method at that situation wht i can do? and they are using same class with same instance.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    It might help if you posted the pieces of code in question and explain what the actual problem is rather than beating around the bush here.

    Edit: And use code tags when you do post code.

Similar Threads

  1. Replies: 3
    Last Post: 03-20-2009, 12:35 AM
  2. Replies: 0
    Last Post: 04-16-2008, 11:07 PM
  3. Replies: 1
    Last Post: 08-07-2007, 05:05 AM
  4. Replies: 1
    Last Post: 08-01-2007, 09:25 PM
  5. Help with static variable counter
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-19-2007, 07:53 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
  •