Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Can single classes be imported (without using : import package)

Reply
Thread Tools

Re: Can single classes be imported (without using : import package)

 
 
Roedy Green
Guest
Posts: n/a
 
      05-08-2008
On Wed, 7 May 2008 20:12:25 +0200, "Juergen Kluth"
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>if i have a useful class in a seperate file , which java code has NO line of
>"package package-name"
>
>can i import this class, allthoug the statement "import package-name" makes
>no sense
>
>is there any "import path\cass-name" statement possible ? or the like ?


no. As soon as you have more than one class you should assign all
your classes to a package.

Packageless classes are just for little one-shot experiments.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
 
Viks
Guest
Posts: n/a
 
      05-09-2008
On May 8, 5:30*pm, Roedy Green <(E-Mail Removed)>
wrote:
> On Wed, 7 May 2008 20:12:25 +0200, "Juergen Kluth"
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> said :
>
> >if i have a useful class in a seperate file , which java code has NO line of
> >"package package-name"

>
> >can i import this class, allthoug the statement "import package-name" makes
> >no sense

>
> >is there any "import path\cass-name" statement possible ? or the like ?

>
> no. *As soon as you have more than one class you should assign all
> your classes to a package.
>
> Packageless classes are just for little one-shot experiments.
> --
>
> Roedy Green Canadian Mind Products
> The Java Glossaryhttp://mindprod.com


Most IDE's will throw up a warning if you write a packageless class.
Packageless classes definitely a bad idea.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do directly imported variables behave differently than thoseattached to imported module? Dun Peal Python 10 05-03-2011 10:11 PM
reloading the module imported as 'from ... import ...' AlF Python 4 08-10-2009 03:00 PM
forcing future re-import from with an imported module _wolf Python 5 12-13-2008 02:38 AM
OOP casting classes (using one single variable for similar types of classes) roberts.noah@gmail.com C++ 8 01-07-2006 04:13 PM
"Variable ... is not imported..." using an imported variable from a module Volker Nicolai Perl Misc 9 07-04-2005 08:34 AM



Advertisments