Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Packages

 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is from K&B.

It says if import statement from the second file(Needy3) is removed , the code will compile and run normally.

I don't get it.
If we are removing the import statement , how is the code accessing the class in the other file (Useful.java).



If some one has a good link for Packages , please it pass it on.
It is kind of confusing.
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The full name of the first class is "xcom.Usefull" and that is what you use in the second one: xcom.Useful uf = new xcom.Useful();

Using imports allows you, to omit the package name and write only the last part of the class name (here: "Useful").

In either case you need a correct setting of the classpath to enable Java to find the class file.
[ July 08, 2008: Message edited by: Ralph Jaus ]
 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it!
Thanks...

That wasn't so tough!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic