call - Java calling methods non/static and private/public -


I had only a few scenarios that I was unsure about, and hoping someone would Can help clarify something

a) If I was in the Sales Mathew class and I wanted to call the sales method by field method, how would I do this? ( Private Method Calling Public Method}

b) What about shopping for calling sales?

c) If I was in Sales Mathew , then a method ( public calling public from within the same class)

c) What will happen to call futureSales method? Do I have to make an example for this because it is non-static?

Public category sales in advance () {code} Private static zero area () {code} Public stable dual purchase () {code}

  public class sales} public zero future () {code}}  

A) Public law calling public law is okay because public sense "visible from everywhere".

  Public stable double area () {sales (); }  

b) Public method calling public law for the same reason is OK.

b ') Private method calling the private method is fine if the private method is the same class from public Ace.

c) To call a non-static method, you must create an example because you call it on an object. You can not call it the way you do it in the example above with a static method.

Static class is relative to "an object relative to a class" of non-fixed one object, you can see that the object is done as an action.


Comments