functional difference between import nameOfPackage & package nameOfPackage

Status
Not open for further replies.

rookie1010

Fully Optimized
Messages
2,069
Hello

i was just wondering about the code line

import nameOfPackage.*;

and

package nameOfPackage;

command in java
are the two command interchangable, providing access to all protected variables within the Mammals package?
 
No, the commands are not interchangeable. With all the fundamental questions you are having about Java, you may want to purchase a book and read it. A book would benefit you more at this point than posting several questions like this on an internet forum.
 
thanks for the reply

i am actually going through an online tutorial and cant get the example code about packages and imports going :(

hence the question
 
Online tutorials are ok, but you'll find a good book will benefit you more at this point.
 
The most thorough and complete book (as well as technically accurate) is "Thinking in Java" 4th edition by Bruce Eckel. There are many other good books, but Eckel is extremely thorough and very clear in his writing. If you decide to pick up this book, make sure to get the 4th edition, as it covers Java 1.5.
 
Status
Not open for further replies.
Back
Top Bottom