Tag: private

57 votes
29 answers
2K views
What is the difference between public, protected, package-private and private in Java?

In Java, are there clear rules on when to use each of access modifiers, namely the default (package private),

avatar
Lynette
0 1 0 9
asked 07 September, 2021
52 votes
17 answers
1.5K views
What is the difference between public, private, and protected?

When and why should I use public, private, and protected functions and variables inside a class? What is the d

avatar
Nidia
0 1 0 9
asked 07 September, 2021