Please view the following link - the tutorial is a tutorial labelled "The Jvava Tutorial" which has a section catered to annotations:
You have to protect variables, because you depend in them.
Limiting the access to the getter and setter, you can depend on the variables to be used in the context you expect to have them.
Also, you can validate the value on the setter, which gives you the chance to to reject the value in case it is not ok (throw Exception). This protects your code from failing.
As a 3. argument: The same variable can be part of different methods/classes. but each name of a variable has to be unique, otherwise the code will fail.
So one limits down the range, where the variable exists as much as possible. therefor, one can use the same name again - not that one does it constantly, but one has the chance to.
And last but not least: it's simply good design/style to do so.
The usage of static should also be limited as much as possible.
There are some occasions where it is needed - but that should be used as less as possible.
Please read about the "encapsulation" - the link, that Richard posted. And please do some more research.
This is a basic of java development. One can't go without this, so you need to understand it.
in the ProductConsumer class, but Netbeans gave me the same error message, "cannot find symbol: method messageList(), location: class ProductConsumer," so I need to create a method messageList() in ProductConsumer. Thanks.
Firstly you need to understand the product you are using: Netbeans does not produce these error messages, they come from the Java compiler; this is a Java program error. Secondly you need to look at your use of the package keyword, as I mentioned in my earlier message. And thirdly, go back to the responses that Torsten.H has given you about your use of messageList().
One of these days I'm going to think of a really clever signature.
There are multiple resources available. In my own opinion, I felt that the following was written very well and helped me understand the concept even better: Thinking Recursively with Java by Eric S. Roberts
The text features the following:
A thorough and clear introduction to the difficult concept of recursion
Uses a broad range of examples to illustrate the principles used in recursion and how to apply them to programming
Features imaginative examples along with various exercises and their solutions.
I've got this exception after running my project
Really don't know what to do!
SQLException: No suitable driver found for jdbc:derby://localhost:1527
I've add derbyclient.jar to Library.but I didn't get any different result.I also don't want to create a new database.
I wasn't able to attach it here but here are two links to download project files.
Last Visit: 31-Dec-99 18:00 Last Update: 8-Oct-15 12:27