I have all this 3 program in the same machine. I believe that we have use socket connection ONLY if we want to call another program running in different machine.
But here, from one command prompt i call first Static1.java and from the another cmd prompt i will call Static3.java. How I can make sure to get the latest changed value when I run Static3.java program.
By using interprocess communication - sockets are one way to do that. It matters not whether the two processes are on the same machineor on different machines. While there are any number of methods (files, databases, RMI, web services, JMS, email, ...), sockets have the benefit of not needing any external infrastructure. All you need to use them is already built into the JVM.
A common misunderstanding. There is one to one relationship from class loader to static variable - not from JVM to static variable. If there happens to be a one to one relationship from class loader to JVM, then the indirect one to one relationship from JVM to static variable is purely consequential.
Tony Morris Java Q&A (FAQ, Trivia)
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners