java - Control access in methods -


I have a question about Java.

I have a class, like say hello () , say something () , sayby () ,. .. I have other classes too. I have a class person , and two sub-categories of person : seniors < / Code> and junior .

To do my work is as follows:

I have to make the Java Java class private, and to create a public class. After this, to create a new example of the Sai Javan class, I have to call the method of getting one with an argument: Example of a senior. Java or Junior. If I make an example of Say.java using a Senior Java Object, then I should be able to reach all the ways of Say.java. But if I do that with junior java, then I say everything. The ways of Java are to say something ().

Can someone explain this and how does it work? / P>

Apologies on the road - I am from Spain, so my English is not great if you do not understand the question, then let me know and I will try to write it more clearly.

First look at this as a reply to private class:

For those items that you want "private", you have to make all areas and potential ways in the private sector (depending on whom you need). Then public Gators and Setters were established as @ user1071777.

Some basic information on calling methods of an object:

To make a connection between the classes, as part of its definition and set it through a constructor or public setter .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -