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.
... 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.