0
What is the difference between "public class"&"class" java?
1 Odpowiedź
+ 9
public is accessible for all parts of your program and also for other (external) programs.
When you have only "class" without the public keyword, it is also known as "package-private", that is only accessible for code that is located in the same package.
To understand this, you should also be aware of namespaces: how a Java program is organized in folders that represent a package hierarchy, and how each Java file is connected to the others in the same package or other packages, by the "import" mechanism.