Advertisement

Author Topic: Java Help!  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

Eyedumgai

  • Guest
Java Help!
« 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!



Like this post: 0

Adverstisement

Eyedumgai

  • Guest
Re: Java Help!
« Reply #1 on: October 06, 2012, 12:00:10 AM »
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?



Like this post: 0

Eyedumgai

  • Guest
Re: Java Help!
« Reply #2 on: October 07, 2012, 11:15:25 AM »
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.



Like this post: 0

 

Advertisements