How java extends Object class?

It is true that we cannot extend more than one class, it is true that java inherits Object class implicitly (if not explicitly) and it is also true that we can extend class X in class Y.
My question is if java does not support multiple inheritance (directly, using extends) then how does it extends Object (implicitly) and my class X (explicitly)?
In other words how does java inherits Object along with our specified class?
Thanks in advance.
Manish

Java does support multi inheritance!Yes I know java support multiple inheritancethrough
interfaces but what I meant was you cannot inherit
multiple classes using "EXTENDS".and that is correct. Do you still have a question
regarding this?Nop, actually due to over-concentration and over-thinking on this topic while reading I lost the track and asked this question.
Thanks
Message was edited by:
Manish_India_1983

Similar Messages

  • Cloneable interface extends Object Class ? T/F can anybody ?

    Can a Interface extend Class?
    If not so, then how come Cloneable Interface extends Objects Class.
    if so, how? can anybody help me out.

    Beats me how you made the jump to this example. Whats
    happening
    here is that when you initialize byte b with the
    integer literal 5, the compiler
    is smart enough to figure out that 5 is in the range
    of byte values,
    so it doesn't complain.I understand what is going on and I know it is somewhat of a stretch but it still feels the same to me.
    As you said, the compiler is smart enough to know that 5 will fit and does not complain; however, according to the JLS integer literals are ints.
    That makes the above example an exception to the casting rule similar to the casting exception between interfaces and Object. Although, the interface situation may very well be specified in the JSL - it might say that all interfaces are a descendent of Object (I can not remember - need to look).

  • Error: initialization error: file java\lang\Object.class not found

    when the error listed my classpath's its not the same list that is in my Windows XP environment variable list?
    I am on 9.0.3
    I am assuming I have to set some varible to my new jdk\bin directory. I reinstalled it. I have set it to use jdk 1.4 using the ojvm tool a while back.

    Please help!!
    I did change the jdev.conf file setting:
    SetJavaHome /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home
    and I still get this error:
    initiallization erro: file java/lang/Object.class not found in classpath
    I am usgin Oracle JDeveloper 10g 10.1.2 on a Mac OS X Tiger
    Could someone please help?
    thanks a bunch!!!

  • Error: invalid file 'java/lang/Object.class' (wrong version: 48, expected 4

    hi all
    ive installed jdk1.4.1 from jdk1.3 .
    When i try to compile a java file i get this error.
    Error: invalid file 'java/lang/Object.class' (wrong version: 48, expected 45)
    anyone has any idea abt this.
    im stuck :( pls help.
    thanks
    Jan

    Did you uninstall 1.3 completely? Completely in the sense both jdk and jre.
    You may get this error if you use javac of one version and the rt.jar of another version.
    Sudha

  • Why isn't Java's Object class abstract?

    Why isn't java's Object class made as abstract class.

    manoj.java wrote:
    Why isn't java's Object class made as abstract class.The only good reason I can think of is that, back in the days prior to Java 5 and the incorporation of java.util.concurrent, bare Objects are useful as thread synchronization monitors (wait(), notify(), notifyAll()).
    --p                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to typecast Object Class object dynamically

    Hai every one
    i have a object of any particular class , but i don't know the variables in that class object. But i have string variable contains value of variables in that class object.
    So i use following method for get value of variables in that class object.
    class ObjectCLass
         Sub s=new Sub();
         public static void main(String[] args)
              ObjectCLass a=new ObjectCLass();
              try
                   System.out.println(*a.getClass().getDeclaredField("s").get(a)*);
              catch(Exception e)
                   System.out.println("Exception");
    class Sub
         int i=5;
         public void print()
              System.out.println("Hello World!");
    }Here the bolder line give Object class object. By using this Object class object i need access the variable i and method print(). So i need to cast Object class object into sub class
    so how can i typecast it
    i try with following methods , but i cant succeed
    1.(  *(a.getClass().getDeclaredField("s").get(a).getClass)*   a.getClass().getDeclaredField("s").get(a)   ).print() ;
    2.(  (Class.forName(�Sub�) ) a.getClass().getDeclaredField("s").get(a) ).print();Please any one one help me how to typecast it dynamically
    By
    Thiagu

    If you know you're going to invoke the "print" method on an object, then you also need to know the type of the class, or interface, which has that method.
    It seems what you are looking for is a tutorial on interfaces.
    http://java.sun.com/docs/books/tutorial/java/IandI/index.html
    In a nutshell, you can set up an interface which defines a "print" method, and create class(es) which implement that interface. Then as long as you have an object which implements that interface, but do not know the exact type of that object, you can simply cast it to the interface type and invoke the method.

  • How to use Object Class:orclDbServer in OID

    Not sure if i have posted in the correct forum, I am quite new to OID
    I am planning to use orclDbServer Object Class, but not sure how to use, i have searched in Google, and Oracle Documentation, there are so little information about this, there are only:
    Object Class: orclDbServer
    Description: Defines the attributes for database service entries
    Attributes: orclNetDescName, orclVersion
    Below is the ldif file i created for add one entry with object class orclDBServer:
    dn: cn=orclDBServer_test, cn=OracleContext, dc=ldapcdc, dc=lcom
    changetype: add
    objectclass: top
    objectclass: orclDBServer
    cn: orclDBServer_test
    orclNetDescName: (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=10.182.114.121)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = oh112)))
    after i use below command to add this entry:
    ldapadd -h localhost -p 389 -D "cn=orcladmin" -w welcome1 -f test_add.ldif
    then use ldapsearch to search:
    ldapsearch -h localhost -p 389 -b "dc=lcom" "objectclass=orclDBServer"
    the result is like below:
    cn=orclDBServer_test, cn=OracleContext, dc=ldapcdc, dc=lcom
    cn=orclDBServer_test
    orclnetdescname=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=10.182.114.121)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = oh112)))
    objectclass=top
    objectclass=orclDBServer
    objectclass=orclService
    It seems it added a line for me:
    objectclass=orclService
    Is there anything wrong with my ldif file when i want to use orclDbServer?
    Edited by: ening on Jan 5, 2010 9:31 PM

    Hi,
    if you are having main controller and sub-controller then you may need to use below coding to use application class reference.
    *Data declaration
      DATA:  obj_cntrl        TYPE REF TO cl_bsp_controller2,
             obj_sub_cntrl   TYPE REF TO z_cl_sub_cntl,
             application TYPE REF TO z_cl_application.
    *Get the controller
      CALL METHOD obj_main_cntrl->get_controller   "obj_main_cntrl is the object of main controller
        EXPORTING
          controller_id       = 'SUB'   "Controller ID
        RECEIVING
          controller_instance = obj_cntrl  .
      obj_sub_cntrl ?= obj_cntrl  .
      application ?= obj_sub_cntrl ->application.
    or simply use below code in your controller method.
      application ?= me->application.
    Thnaks,
    Chandra

  • How to create object class for a z table

    Hi All,
    I have a z table and I want to register the changes of fields should be logged to CDHDR and CDPOS table.
    Is this possible?
    If yes how can I creat an object class for a z table. I have already checked the change document option in z data element.
    Please help.
    Regards,
    Jeetu
    Moderator message: standard functionality, please search for available information/documentation before asking.
    locked by: Thomas Zloch on Oct 6, 2010 6:16 PM

    Tcode SCDO. You'll need to create a change document for you Z table and then use the FM created to record the changed data.

  • How to extend a class in same package

    I have a class called LoginBean.java which extends the class ConnectDB.java
    this both files have a statement both the classes are under the directory pmtools.
    and both are included in package pmtools.
    (they both have statement "package pmtools; " at top)
    when i am trying to compile LoginBean.java, it is giving me following error,
    LoginBean.java:7: cannot resolve symbol
    symbol : class ConnectDB
    location: class pmtools.LoginBean
    public class LoginBean extends ConnectDB
    ^
    LoginBean.java:59: cannot resolve symbol
    symbol : variable dbConn
    location: class pmtools.LoginBean
    stmt = dbConn.createStatement();
    ^
    2 errors

    did you compile the other class already? donnow if ithahahaha!!!!!
    ok include the import statement
    import pmtools.ConnectDB;
    in the second class and than compile..

  • How to make Object class to be serializable?

    I'm writing a session bean which contains an Object[][] as a return e.g
    public Object[][] getFoo(){
    I need the return to be of type Object since I'm constracting a 2D array of different object types e.g Integer, Double, HashMap, String etc. But EJBs require serializable objects for their public remote methods. Could you please advice me whether there is another class that I could use instead of the Object class to be serializable? I'm still using SDK1.3.1.
    Thank you

    I've already tried that before, but it doesn't work. When I try to assign different objects to my array as in the following example:
    ABC[][] abc = new ABC[4][2];
    abc[0][0] = new Integer(1);
    abc[0][1] = new String("abc");
    abc[0][2] = new HashMap();
    I'm getting compilation error since Integer, String and HashMap can not be casted into ABC. My question is whether there is such a class (part of the SDK) which implements Serializable AND these classes can be casted to, as in the above example?

  • AS3.0: How to extend a class that extends MovieClip

    When I try to set the base class of a library symbol to a
    class that doesn't DIRECTLY extend MovieClip, but instead extends
    another class that DOES extend MovieClip, it's disallowed, saying,
    "The class 'Whatever' must subclass 'flash.display.MovieClip' since
    it is linked..."
    Is this just a validation bug in the property windows, only
    checking one class deep into the inheritance hierarchy? Because the
    specified class does extend MovieClip, just two levels in instead
    of one. Is there a fix for this? Or must library symbols always
    directly extend MovieClip? If so, why?

    Which classes from flash.display have you imported. Just
    because a class extends another doesn't mean that it inherits all
    of its properties. Saying a class extends sprite doesn't give you
    access to all of it's properties, members and display unless you
    first import flash.display.* or flash.display.Sprite. If you aren't
    already importing flash.display.*, try importing
    flash.display.MovieClip and see what happens...

  • How to extend a class from super package?

    Say I have a dir a\
    in dir a\ there is a dir b\
    in b\ there is a class called DerivedClass
    in a\ there is a class called ExtendedClass
    how do I extend ExtendedClass from DerivedClass?

    package a.b;
    import a.ExtendedClass;
    public class DerivedClass extends ExtendedClass{
        //define class members
    This is interesting. But the question is, how does java know where is package b??     By the classpath variable - the classpath is set to one directory above 'a'. When you say
         a.ExtendedClass, since the classpath is set to the immediate parent of a, it searches the child directories
         for a directory called 'a' and upon finding it, searches for a .class file 'ExtendedClass'.
         Similarly when you say a.b.DerivedClass, the search begins in the parent directory for a directory called a and then
         a directory 'b' inside it on finding which it searches for DerivedClass.class
    Alternatively you could have defined DerivedClass to be in package 'b'.     
         package b; //note the difference. Its b and not a.b
         import a.ExtendedClass;
         public class DerivedClass extends ExtendedClass{
             //define class members
         }in which case, you should set the classpath to
    1. a's parent directory
    2. a itself
    The parent directory cp is still required to locate a.ExtendedClass
    The fully qualified name of DerivedClass is b.DerivedClass
    Thus if #1 alone were present, since 'b' is not directly inside the parent directory,
    b.DerivedClass would never be found
    Hence the #2 is required-the search should start from the directory 'a' (as directory 'b' is inside 'a').
    therefore, a package is a directory.No, package is a very java specific thing and though logically package names should match directory names, they
    arent the same.
    cheers,
    ram.

  • How java handles package/class names

    I am developing a strategy for internationalizing our company's middle-ware product. While I have no problem with the GUI's, exceptions, log files etc, I have no concept of how things like classpaths and packages can be specified in an asian language.
    For instance, if I have configuration information of com.abccompany.mypackage.MyClass, what will this look like to the asian user? Will they be able to change it to perhaps com.abccompany.mypackage.MyClass2 by entering localized data in Chinese or Arabic? I don't understand how this part works. On the command-line, will they type English script names? Do they run commands like so: java -cp com.abc.pkg1.jarfile.jar MyClass? Will my english filenames, packages, etc be represented in asian characters?
    We have a lot of configuration information that specify java classes as String data. I am concerned about the ability to modify this data and have it work correctly in languages that do not use the ascii character set. Is this something I need to be worried about?
    I appreciate any input. Thanks in advance.

    You do not need to warry about configuration information of com.abccompany.mypackage.MyClass
    and command-line no matter what languages used in Asia. Asian users also type in English script names or java -cp com.abc.pkg1.jarfile.jar MyClass as you do so. The only thing you need to note is
    that any text strings or messages which you want to show on any panel/dialog/window/frame and so on should be store in a resource file for internationalizing.

  • How to extends base class???

    Hi here I want to extend GoogleApiKeyStore. I am sure that this class is availabe, because when I  writing to import this class flash showing this classname in hint dialogue box. but when i make object of mykey in my document class then it shows error: The definition of base class GoogleApiKeyStore was not found.
    package code {
              import be.boulevart.google.apicore.GoogleApiKeyStore
              public class mykey extends GoogleApiKeyStore{
                        public static const API_KEY : String = "xxxxxxxxxxxxxxxxxxxxxxxx"
                        public function mykey() {
                                  // constructor code

    download and save the class to make it local.

  • How Java handle duplicated class?

    I am trying to send out email using SUN JavaMail. However, an old version of JavaMail was shipped with Oracle AppServer 10 R2. If I package the new JavaMail into the WAR file, the old JavaMail is still functional, and cause problem to my program. Is there a way to tell the AppServer to use the JavaMail in my WAR file instead of the old one shipped with the server?
    Thanks very much!
    Edited by: huaichen on Nov 6, 2008 2:02 PM

    Hi,
    does this help you? It's from an older vesion but might wor kin your case.
    How do I setup OC4J to load local classes packaged in my Web Application overriding System classes or classes in the higher level?
    OC4J 9.0.3 has a configurable option to load local classes first, overriding classes at a higher level. You have to include the following to directive in the orion-web.xml for your web module to ask OC4J to load local classes:
    <web-app-class-loader search-local-classes-first="true" />Timo

Maybe you are looking for

  • [Solved] Unable to boot Arch off SUSE GrUB

    Hi, I have several OS installed on my machine. I used to boot everything including Arch but BSD, Solaris & PCBSD with GrUB2 off UbuntuStudio. Earlier today I installed SUSE GrUB on sda and now I am unable to boot Arch. I've used SUSE GrUB earlier and

  • Informatica powercenter adminconsole link not working on Linux 64 bit

    Hi all, I've installed Informatica powercenter 9.0.1 server on Linux 64bit machine. When I try to launch adminconsole from my linux machine it is giving following error, "Data Transfer Interrupted" "The Connection hostname:6001 was interrupted while

  • How can i make a remix using songs from itunes

    I am trying to create a wedding mix using chorus' from different songs that I have in itunes. I have drug all of the songs into GB but now they all run together and sound HORRIBLE! How do I edit each track to just use a part of the song? You know, li

  • Is it really a Partner?

    http://soft4pcs.com provides low price softwares like adobe products Saying that they are an ADOBE CERTIFIED PARTNER is it real or it is a scam???

  • Issues related to process chains

    dear gurus, i hope all are doing great, this is the message regarding the issue with process chain in sap-bw(from application server) i'm trying to load data from flat file to ods and infocube parallely, i've created the infocube and ods object and i