Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Default Class Access ?  RSS feed

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
"A class with default access can be seen only by classes within the same package".
When you say DEFAULT PACKAGE, does this mean on the same directory/location?
Thanks all.
Cyrus,
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cyrus,
[We meet again ]
The "default package" is the "unnamed package". Any java source code file that does not contain a package specification, i.e. the first non-comment line in the source code file is NOT

is considered to be in the "default" package, and its location is determined by the CLASSPATH setting(s).
For example, if your CLASSPATH (on a Windows machine) is:

then java "class" files in this directory (that don't contain a package specification) are considered to be in the "default" package.
Hope this answers your question.
Good Luck,
Avi.
P.S. By the way, do you know about these (excellent, in my opinion) java resources:
SUN Java Tutorial
Thinking in Java
Safari online library
[ November 18, 2003: Message edited by: Avi Abrami ]
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello AVI,
thanks for the relentless response ( in my opinion )

sometimes, when reading books it tends to bore you, but i dont have a choice, "READ ON" as sierra and bert commented on their book.
can you recommend any free readables online for me to learn Java, i wish to learn how to create a program in an OOP way. a couple of local books in our country simply, defines what is OOP, but lacks examples on how PROGRAM should be structured.
currently im an instructor and finding ways how could i teach Java in a simple but effective way.
thanks again..
Cyrus
[ November 21, 2003: Message edited by: Cyrus Serrano ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!