Guys have a look at this statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys have a look at this statements

"Thus, on the one hand, we have files stored in folders, and on the other – classes stored in packages. A class name must also coincide with the name of the file describing the class. The package name coincides with the name of the folder where the class is stored." I dont get the last two lines Please explain with some examples.

21st Sep 2020, 4:48 AM
stephen haokip
stephen haokip - avatar
2 Answers
+ 1
If .java file is situated inside a folder named mypackage, this name must be included in the file after the package keyword: Tree: src/mypackage/MyClass.java Inside MyClass.java: package mypackage; public class MyClass{}
21st Sep 2020, 5:37 AM
Aleksandrs
Aleksandrs - avatar
+ 3
package myp with class Myc is stored on your computer myp(Folder) MyC(File)
21st Sep 2020, 5:33 AM
Oma Falk
Oma Falk - avatar