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. Advertisements

  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. Advertisements

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. Andy Fish
    Replies:
    2
    Views:
    3,352
    Andy Fish
    Jul 22, 2005
  2. Carfield Yim
    Replies:
    1
    Views:
    2,042
    Andrew Thompson
    May 31, 2004
  3. Parvinder
    Replies:
    6
    Views:
    1,003
    Thomas G. Marshall
    Feb 27, 2005
  4. George P
    Replies:
    3
    Views:
    896
    Alex Martelli
    Sep 11, 2004
  5. Replies:
    8
    Views:
    1,562
    Victor Bazarov
    Jan 7, 2006
  6. Gabriel Rossetti
    Replies:
    1
    Views:
    658
    ryles
    Sep 20, 2009
  7. Dun Peal
    Replies:
    10
    Views:
    715
    Chris Rebert
    May 3, 2011
  8. Volker Nicolai
    Replies:
    9
    Views:
    2,138
    Fabian Pilkowski
    Jul 4, 2005
Loading...