• Post Reply Bookmark Topic Watch Topic
  • New Topic

Clarity on packages/classes  RSS feed

 
Jacob Draper
Ranch Hand
Posts: 35
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I am looking to clarify if a package can exist within a package in java...


Also, is java a package (as in java.lang)?

Is system a package? I know it is a class but is it also a default package?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the existence of packages such as java.util.text answer your question?

Hint: Javadoc
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, System is a class (java.lang.System to be exact), but not system.
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Packages can be and often are part of other packages.

Java in java.lang is just a name. Not each part of a package name needs to be a package.
 
Paweł Baczyński
Bartender
Posts: 2083
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Does the existence of packages such as java.util.text answer your question?

Think about Java the language. How is java.util.text related to java.util? There is no relation between those two as the language is concerned.
The only thing they have in common is part of a name and part of a directory tree where their source code is located.
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, a package name should be all lower case. The class name should be PascalCase (first letter capitalized and the beginning of each word capitalized).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pawel Baczynski wrote:
Bear Bibeault wrote:Does the existence of packages such as java.util.text answer your question?

Think about Java the language. How is java.util.text related to java.util? There is no relation betweed those two as a language is concerned.
The only thing they have in common is part of a name and part of a directory tree where their source code is located.


Good point, but the folder structure is how I assumed that the OP was looking at things.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!