This is very entry level question and might have been answered already.
My question is, what is the correct way to name my package folders?
for example, I want to have package named - com.stack.abc
Option A- shall I create package folder with name - com.stack.abc?
or
Option B- shall I create folder structure as shown below?

com |_stack |_abc 

To summarise, I should have only one folder (com.stack.abc) or 2 subfolders under com?

2 Answers

To your question, com.stack.abc should be the folder hierarchy structure.

com |-stack |-abc

2

Edit due to main post edited;

You would create 3 different folders. One folder called com, one folder inside com called stack, and one folder inside stack called abc. On some, or most IDEAs, it will look like 1 folder because it looks like com.stack.abc but it's really 3 folders.

Generally you define the source folder (top level of all java files) as

src/main/java/ 

Then you define the package that represents your website (if any)

com.stack.abc 

This would resolve to;

abc.stack.com 

The entire directory would look like this;

src/main/java/com/stack/abc 

This might be a helpful link into packaging conventions.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy