| Author |
why they are no need to import?
|
Supun Lakshan Dissanayake
Ranch Hand
Joined: Oct 26, 2012
Posts: 46
|
|
To use classes in java packages we do import the whole package or necessary classes.
But we NEVER import some classes like String, Integer, Double, Object.
How can we use them without import them?
|
Try and Try one day you can FLY.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
Read about it in The Java™ Language Specification.
Every compilation unit implicitly imports every public type name declared in the predefined package java.lang, as if the declaration import java.lang.*; appeared at the beginning of each compilation unit immediately after any package statement. As a result, the names of all those types are available as simple names in every compilation unit.
|
luck, db
There are no new questions, but there may be new answers.
|
 |
vinay chaturvedi
Greenhorn
Joined: Jan 16, 2012
Posts: 14
|
|
The java classes such as String, Number, StringBuffer, StringBuilder, Object, etc. are present in package "java.lang". In every java class this java.lang package is by default imported.
Hence all these classes are available in a class.
|
 |
Supun Lakshan Dissanayake
Ranch Hand
Joined: Oct 26, 2012
Posts: 46
|
|
Thanks Guys!! problem resolved.
|
 |
 |
|
|
subject: why they are no need to import?
|
|
|