Patriots_fan
Patriots_fan

Reputation: 21

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?

Upvotes: 0

Views: 201

Answers (2)

Molly Wang-MSFT
Molly Wang-MSFT

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:

enter image description here

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

Upvotes: 1

LtDan4
LtDan4

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

Related Questions