File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Share objects in a standalone java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Share objects in a standalone java application" Watch "Share objects in a standalone java application" New topic
Author

Share objects in a standalone java application

Janelle Goldsmith
Greenhorn

Joined: Mar 20, 2003
Posts: 12
Hi everybody,
I am fairly new to Java and want to know all the possible mecahnisms to share objects in a standalone java application.
Thanks
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451

... all the possible mecahnisms to share objects in a standalone java application.

I doubt that they've all been tried. All objects are unique (one of the core principles of Object Orientation) and can be shared among any other object in a variety of ways. They can be passed as parameters in methods, they can be returned from methods, they can be referenced directly as fields, they can be members of collections, etc. The thing to remember in Java though is that objects can only be accessed by a reference. Objects can become orphaned when there are no longer any reference that refer to them. When that happens they become subject to garbage collection.
Michael Morris
[ March 20, 2003: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
...and then there's all those funny persistence strategies.
Welcome to JavaRach, Janelle! What are you trying to accomplish?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Janelle Goldsmith
Greenhorn

Joined: Mar 20, 2003
Posts: 12
Thanks for the welcome.
I heard about storing the objects in persistent storage like files etc.
When would that be used in a standalone java application ?
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I heard about storing the objects in persistent storage like files etc.
When would that be used in a standalone java application ?

Whenever you need to store and retreive the state of the object. For example, your program monitors the stock market activity during the trading day. After the trading day, you can close your app. When you restart it the next day, your program will restore its state and resume execution.
Eugene.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Share objects in a standalone java application