Name: Anonymous 2008-02-10 15:34
Ok so im in my second semester of comp science, the first semester I learned the basics of C++ and I loved it. However this semester I'm learning Java and it just isn't coming together for me so I have some questions about it.(sorry for the noobness)
1. What are constructors for? I understand that when I create a new object the constructor is "new" but I don't get when I need to use them.
2. What's the whole deal with the "public" and "private" in front of a class or method, in what situations should something be private or public?
3. When declaring variables I'm confused about when I should declare varialbes in the main method or in some other method. Also when are variables declared under the main class?
Thank you
1. What are constructors for? I understand that when I create a new object the constructor is "new" but I don't get when I need to use them.
2. What's the whole deal with the "public" and "private" in front of a class or method, in what situations should something be private or public?
3. When declaring variables I'm confused about when I should declare varialbes in the main method or in some other method. Also when are variables declared under the main class?
Thank you