aspose file tools
The moose likes Beginning Java and the fly likes why they are no need to import? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "why they are no need to import?" Watch "why they are no need to import?" New topic
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
    
    3

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: why they are no need to import?
 
Similar Threads
static import
Import or inline?
isn't interface support inheritance
Unable to set CLASSPATH in Linux-based OS