aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes importing java.lang Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "importing java.lang" Watch "importing java.lang" New topic
Author

importing java.lang

Omkar Shetkar
Ranch Hand

Joined: Jun 22, 2006
Posts: 41

Hi All,

I have got a doubt regarding very basic fact of Java i.e., why we need not import java.lang package? What is the mechanism in Java which makes any program to have access to the default package?

Regards
Omkar V S


http://writingsontech.blogspot.in/
Ian Edwards
Ranch Hand

Joined: Aug 14, 2006
Posts: 107
There's nothing stopping you importing the java.lang package yourself - its just not required as the compiler will automatically do it for you.

This package provides classes that are fundamental to the language. You won't get far without it.
Swapnil Sonawane
Ranch Hand

Joined: Jan 02, 2008
Posts: 190
Yes. You need not import java.lang as Java does it automatically for you. There is no harm even if you import that explicitly.


Swapnil S. Sonawane<br /> <br />B.Tech (Expected May 2009)<br />Computer Science, NIT Durgapur, India<br />SCJA 1.0
Omkar Shetkar
Ranch Hand

Joined: Jun 22, 2006
Posts: 41

But I want to know how Java do that?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18109
    
    8

It's done by special-case programming in the compiler.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing java.lang
 
Similar Threads
important package
threads
Thread question
can we create object of the interface and what is the base package of java ?
Name the mutable and immutable Classes