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

Discussion in 'Java' started by Roedy Green, May 8, 2008.

  1. Roedy Green

    Roedy Green Guest

    On Wed, 7 May 2008 20:12:25 +0200, "Juergen Kluth"
    <> 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
    Roedy Green, May 8, 2008
    #1
    1. Advertising

  2. Roedy Green

    Viks Guest

    On May 8, 5:30 pm, Roedy Green <>
    wrote:
    > On Wed, 7 May 2008 20:12:25 +0200, "Juergen Kluth"
    > <> 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.
    Viks, May 9, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carfield Yim
    Replies:
    1
    Views:
    1,393
    Andrew Thompson
    May 31, 2004
  2. Parvinder
    Replies:
    6
    Views:
    733
    Thomas G. Marshall
    Feb 27, 2005
  3. Replies:
    8
    Views:
    1,344
    Victor Bazarov
    Jan 7, 2006
  4. Dun Peal
    Replies:
    10
    Views:
    441
    Chris Rebert
    May 3, 2011
  5. Volker Nicolai
    Replies:
    9
    Views:
    900
    Fabian Pilkowski
    Jul 4, 2005
Loading...

Share This Page