aspose file tools*
The moose likes Java in General and the fly likes Basic question about the sources of Sun Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Basic question about the sources of Sun" Watch "Basic question about the sources of Sun" New topic
Author

Basic question about the sources of Sun

Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Hi
I have looked in the source of Sun class (of 1.3) and I couldn�t figure out a few things:
What is transient? And when and why I need to use it?
What is synchronize? And when and why I need to use it?
In the method block I saw return alone, and return this? What does it mean?
About decimation :
When I need to use @throws , @exception? If the exception were thrown by his super class I still should mention it in the documentation?
I saw several method that can throw Null Exception but they don�t mention it in the documentation, why?
Thanks
Shay Gaghe
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Can someone reply please?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Shay
You've got several questions here that could each take a while to explain. Have you looked at the Java tutorial from Sun? Reading that might give you better idea of twhat these items are and what they are used for. After that then you could post specific questions about one of the items. Also, try to keep your topics to just one item or related items - the reason is that it makes it easier for people to find them if they are doing a search on the site for answers of their own. I'll give you a quick answer for each of these:

What is transient? And when and why I need to use it?
Transient is used in serialization. When you mark a variable transient theya re not serialized -they aen't stored as part of the object when it is serialized. It is/can be used a lot in security.
What is synchronize? And when and why I need to use it?
synchronized is used in multithreaded applications. It is used to mark a block of code so that it can only be accessed by one thread at a time.
In the method block I saw return alone, and return this? What does it mean?
A single return statement with nothing after it just returns to the calling block of code. 'this' is a special keyword that is usually used to refer to the current object (at least in the case your asking about), so if you have 'return this;' in a method it is simply returning the current object.
When I need to use @throws , @exception? If the exception were thrown by his super class I still should mention it in the documentation?
I havent used the javadoc too much so I really cant help you there. There is a whole forum for this.
I saw several method that can throw Null Exception but they don�t mention it in the documentation, why?
I've never heard of a NullException, do you mean NullPointerException? This exception is usually thrown if your code is trying to use an Object who's value is null. This is a RunTimeException so it doesn't hae to be specified in the method declaration though.
another good source is Bruce Eckels Thinking in Java (free book), it is a free book to download.
hope this helps you out a little

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform


Dave
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Thank you
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Thank you Dave
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Basic question about the sources of Sun