Java Package Folder Naming Conventions
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...
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
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.