A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Programmer Certification (SCJP/OCPJP)
package and import
Joined: Sep 03, 2007
Oct 21, 2007 07:11:00
which one comes first in declaration in a class?
which one is only allowed with one and only one?
Joined: Oct 21, 2007
Oct 21, 2007 07:23:00
if both are included "package" has to be the first to be included and then followed by the "import"..
if there is only one class "package" is not required unless you have included your class within a package.
"import" is not required if you are refering to classes defined in java.lang package which is loaded by the JVM classloader before you class is executed.
You Want it.. Get it.......the Right Way...<br /> <br />SCJP 5.0 SCWCD 5.0
Joined: Aug 25, 2006
Oct 21, 2007 08:07:00
import is never
you may say e.g.
java.util.List myList = new
without importing anything.
Imports are only for saving some typing work.
I agree. Here's the link:
subject: package and import
Stars program help
Mandrake 10.1 / Fedora / Suse
Application Server vs JUnit Performance Issue
Doubt in Garbage Collection...........
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015