简体   繁体   中英

Is creating a package in Eclipse, equivalent of creating a new folder?

I'm not using Eclipse, so for my project when stated "create a new Java project called "Project 1", and import the above 2 files into a default package. " Is that the equivalent of just throwing the two files into a folder and naming it "Project 1"?

Because I'm using VS Code, If not how would I be able to create a package on VS Code?

Yes, about package in VS Code, the first thing we need to do is creating a folder.

When we create a folder under src, which we assume its name is AAA . if a .java file is created under AAA, there will be a statement package AAA; on the top line, like the screenshot shows:

在此处输入图片说明

If package AAA; isn't generated automatically, we should add it manually in every file which is under this folder.

A package is a subdirectory below the src directory which is below the project directory. You won't run into any issues using the default package, but it is generally good practice to put all your class and other files into a package so it is more organized.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM