• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Sun Fooling US

 
sachin verma
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my first ever post in this forum so first I want to say Hi to all.

Now I have been using JAVA Documentation from a long time.
And because it was released from sun too, I did not expect any flaw in it.
But now I don't trust it at all.
Reason is
For instance when I see System class Documentation in jdk-1_5_0-doc\docs\api\java\lang\System.html
It shows that System is a final class and it is also a direst subclass of Object.
like the below->>>>>>>
public final class System
extends Object

But when I see System.java file in jdk1.5.0_14\src\java\lang\System.java
It shows something like this

package java.lang;

import java.io.*;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AllPermission;
import java.nio.channels.Channel;
import java.nio.channels.spi.SelectorProvider;
import sun.net.InetAddressCachePolicy;
import sun.nio.ch.Interruptible;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
import sun.reflect.annotation.AnnotationType;


public final class System {
//Specific code
}




My Question is "Why this Difference Exists ?"
And what is the purpose of Documentation then If it does not provide the correct n Exact information?

I am preparing for scjp 310-055
I have been using java from last 3 years.


[Removed non-words from subject line]
[ April 21, 2008: Message edited by: Ben Souther ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15206
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difference? I don't see a difference.

As you see in the source code, class System is indeed final. You never need to extend class Object explicitly - classes that don't extend a superclass implicitly extend class Object.

So the information in the documentation is correct.

Also, please pay attention to the following: Here on JavaRanch, we have a naming policy. We want the users of JavaRanch to use a real-sounding name as their display name.

Your name "scjp sachin" is not a real name. So please change your name in accordance to the naming policy. You can change your name by editing your profile.

Please note that we are taking the naming policy seriously. If you do not change your display name, your account on JavaRanch might be locked.
[ April 21, 2008: Message edited by: Jesper Young ]
 
sachin verma
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for telling me the naming policies..I have changed it.

Are you trying to say that every class that we construct is implicitly a direct subclass of Object class (that is on the top).Or it provides us its infomation through hierarchy.
like
Object-->SomeClassesToSupportThreading-->SomeClassesToSupportException-->etc etc-->UserClass

If it provides through hierarchy then isn't it important then whenever someone uses the direct sub classing from Object...he/she should provide the exact way of using.
Does it matter to subclass direct from Object, Or through hierarchy ??
.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java has a singly rooted hierarchy, meaning that a single class (java.lang.Object) is at the top of the hierarchy for all objects.

As the JLS states under section 4.3.2, "The class Object is a superclass (�8.1) of all other classes."
 
sachin verma
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic