Accessing class, the right way
My first post:), you all participate in a fantastic forum and i am happy to be apart of this learning experience.
I am fairly new to Java; having played around with it for a few months before now studying it at Uni (have just started). I have completed an assignment in two forms. I have completed it using methods in a procedural fashion, as this is what i am comfortable with. I have also re-done this assignment using classes.
My question is this:
I have called the classes by creating an object (as you do) and simply accessed them in the same fashion as you would a method in a procedural program. for example:
MyClass myClass = new MyClass(arg1, arg2);
This works fine and my program runs without a hitch. But is it this form exceptable? should i instead be returning values from my class arguments. The classes themselves are for printed menus and mathematical equations etc..
I guess im asking this because although this works fine, i get a little warning message on my coded work (eclipse) stating that this local variable is never read. I understand what the warning is saying, i am just looking for ideas on whether the way i have accessed these classes is acceptable or is it frowned upon.
I would appreciate any thoughts on this subject.