File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes important package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "important package" Watch "important package" New topic

important package

pravanya Gullapudi

Joined: May 07, 2007
Posts: 16
i know that java.lang is an important package. why it is important?
Alan Smithee

Joined: Mar 21, 2006
Posts: 23
Originally posted by pravanya Gullapudi:
i know that java.lang is an important package. why it is important?

All classes directly or indirectly extend java.lang because java.lang is where the Object class resides. Since all java objects are ... well ... objects you need java.lang to be able to reference java.lang.object.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43359
Not really. You are extending the Object class, not the java.lang package.

The java.lang package contains classes which are used all the time, including Object. It just so happens that in Java you don't have to import a class in the java.lang package, because the compiler looks for classes there anyway. Other languages don't have this feature; in C# for example you have to write something like "using System" at the beginning of every program to get at classes.

More about java.lang here in the API documentation.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11814

"Alan Smithee",

It has recently come to our attention that your screen name does not comply with our Naming Policy. Specifically, I refer to the "Obviously fictitious names may be locked out" part.

Please go here and edit your profile to comply.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
It is sorta covered in the JavaRanch Style Guide.
subject: important package
jQuery in Action, 3rd edition