+ 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.
2 ответов
+ 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{}
+ 3
package myp
with class Myc
is stored on your computer
myp(Folder)
MyC(File)