• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Packages

 
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it!
Thanks...

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