Results 1 to 4 of 4

Thread: Good Question: Static Data Across Apps?

  1. #1

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Question Good Question: Static Data Across Apps?

    if i have two SEPERATE programs run (aka. different class to the JVM of public class) and they both use a static class/class member will they see the same values or is static just static within a single program running?
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  2. #2
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    I'm pretty sure its static within the program.
    Otherwise you could have all sorts of problems if you had your variable named the same as one in another program that was running.
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

  3. #3
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Originally posted by Mrs Kensington
    I'm pretty sure its static within the program.
    Otherwise you could have all sorts of problems if you had your variable named the same as one in another program that was running.
    Buf if a Static member is available without creating an instance of a class, in CaptainPinko's example, the two classes would not be using any instance of the static class or the class having the static member, instead they would just be using whatever is there. How would the JVM track two different values for the static member?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  4. #4
    VirtuallyVB
    Guest
    I agree with Mrs Kensington.

    I'm pretty sure that "two SEPERATE programs run - CaptainPinko", means two separate JVM's are running. What does "aka. different class to the JVM of public class" mean?

    "How would the JVM... - honeybee", again I believe it would have to be that the single instance of a JVM would be keeping track of whatever was invoked by that invocation of "java SomeClass". A second invocation of "java SomeClass" or "java DifferentClass" should be in different memory spaces.

Posting Permissions

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



Click Here to Expand Forum to Full Width