This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello Friends, I have following doubts. 1) Why did java designers make Object class as super class to every class? Any specific reaons? 2) Why did java designers provide java.lang package by default? Any specific reasons? Thanks for the help, Sridhar Garimella.
Hi garimella 1) In my opinion Object class actually provides a mechanism to handle any kind of Object polymorphically. Or in simple words You can say that it acts as the most common handle/reference an object can get So you can deal different objects in same category. 2) java.lang package contains all the classes a user's class may need without importing any other package. This prevents any beginner to be confused in packages.
1) Because in an object oriented language "evereything" is supposed to be an "object". Of course primitives are an exception to this rule in Java, for efficiency reasons. 2) Sun provides LOTS of libraries that we can use. The java.lang package is just ONE of these provided in the jre. They did this because they are REALLY good at coding java , and they wanted some control over the way the basic functionality of the language grew and was implemented.
"JavaRanch, where the deer and the Certified play" - David O'Meara