I think the way in which i write programs is wrong. So i just need to clarify it. I use small alphabets for naming the class and sometimes i even write many classes in the same program(i.e in a single file). This has become a habit for me. I think there may be many more mistakes which i do but i dont even know. So please some one look at the code below and point towards the mistakes. I would be really a great help for me.
Thanks and Regards
adeeb alexander wrote:Hi all.
I think the way in which i write programs is wrong. So i just need to clarify it. I use small alphabets for naming the class...
That is indeed not what the de-facto coding conventions recommend, and how classes and interfaces are named in the standard Java API. See Code Conventions for the Java Programming Language - those standards are used by most Java programmers.
... and sometimes i even write many classes in the same program(i.e in a single file). This has become a habit for me.
A better way is to put each Java class in a separate file, with a name that's the same as the class name (and the extention .java, ofcourse). Sun's Java compiler even requires this for public classes.
Looking at your code, here are some more tips: Make your member variables private, unless a more permissive access level is required. Currently, your member variables all have the default access level. Indent your code consistently, that makes it easier to read.
There is a great book about how to write good Java code: Effective Java. Buy it - you won't regret it, and it will make you a better Java developer.
Also, the Java Code Convetions will help you
Can you please give an example for diff connection and display class. I mean how to declare connection in one class and display in other class and use them both to gether