Reputation: 21
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?
Upvotes: 0
Views: 201
Reputation: 9451
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.
Upvotes: 1
Reputation: 26
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.
Upvotes: 0