224k views
4 votes
When is it not necessary to invoke the method myMethod using dot notation? When myMethod is private. When myMethod is invoked by a method in the same class as myMethod. When myMethod is public. When myMethod is both private and static. When myMethod is invoked by a method in a different class than myMethod.

User Androliyah
by
4.4k points

2 Answers

2 votes

Answer:

When myMethod is invoked by a method in a different class than myMethod.

Step-by-step explanation:

Other classes can invoke the function written in different classes using the dot notation.

User Michael Wang
by
4.3k points
7 votes

Answer:

When myMethod is invoked by a method in the same class as myMethod.

Step-by-step explanation:

When you are in a class, it is like a different enviroment and within that class you can call a method without using the dot notation because you are still within the class.

Outside the class and despite the type of method, public, private or static, the dot notation will be required.

User JustAPup
by
5.0k points