+ 2
When creating a method in a class that is to be called from another class, is it necessary to put the public and static keyword?
JAVA
4 Answers
+ 1
You must use the public keyword, otherwise you will not be able to call it from another class. Static means that the class is not an instance type.
+ 4
use protected...
protected also allows to use method in derived class..
+ 2
Yes, you can also use protected, if both classes are in the same packadge, otherwise you most use public.
+ 1
I think public is better