PebHmong Discussion Forum
Hobbies & Interests => Computer & Technology => Topic started by: Eyedumgai on October 05, 2012, 07:50:08 PM
-
I'm having the hardest time grasping the theory of Java and its OOP aspect. Can anybody help me to understand how to call another object from the main object?
Suppose I have two objects, one is the main program, we'll call it Main.java; another is the object that does all the calculations of sales, compensation, etc...we'll call this SalesPerson.ja va object. This object has a cacTotalSales() method.
How do I properly call up the SalesPerson.ja va object from the Main to display its calcTotalSales() method in a System.out.pri ntln() statement?
I think I just came to the realization that I'm not so good at OOP languages (or any languages other than HTML/CSS)... :(
Help me to understand! Thanks!
-
That's it! Instance of a class! Thanks for making that easy to understand! I was wondering what that meant. Does the instance and its method to call the sp class have to reside within the main block?
When and why would you have a method outside the block? When do you know when to put it outside the main block?
-
Careful with global scope...It's the bane of a programmer's existance.
What does scope mean? I hear that term often, just like instance of a variable, or instance of a class, but not sure what it means.