Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Heararchi

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should be the herarchi of a Java Class
1] project
2] package // optional
3] folders // optional
4] classes , interfaces

Is this right ?

'No modifier' means accessable in package only not outside the package .
Is they r accessible out side the folder but inside the package .
should be ...

Thanks for reading . If any thing wrong or you know somrthing more & that is important then please post ..
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A package can contain multiple classes and interfaces.

A folder can contain multiple packages, but folders are more an operating system concept. The only Java piece is that the classes and interfaces in a package should reside a folder whose name derives from the package name.

Project is not a Java concept, but it is important in IDE's like NetBeans 4.0. I think a project can contain multiple packages, but that depends on the IDE.
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'No modifier' means accessable in package only not outside the package.

yes

Is they r accessible out side the folder but inside the package.

No classes or interfaces inside a package should be outside the folder whose name is derived from the package name.


Please avoid IM slang like "r" for "are". Perfect English grammar is not important, but many people who are just learning both English and Java find these strange abbreviations very confusing. Thank you. Mike
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic