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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Why wait() is there in Object class why not in Thread class

    why wait() is there in Object class why not in Thread class .
    while we use wait() in the case of thread environment?
    If there is any situation where we use it without using threads please mention with example. or link to that example..

    839091 wrote:
    The question still remain un-answered as the answers provided are not clear. Can anybody explain why wait(), notify() methods are available in Object class and not thread?What part of the answers given did you not understand?
    Have you even tried writing any code that uses wait/notify and thought about how you'd write the same code if they existed only on Thread rather than on Object?
    Have you studied the basics of Java's multithreading?
    Do you know what a lock is?
    Do you know what the synchronized keyword does?
    Do you understand the relationship between synchronized and wait/notify?
    If you can answer yes to these questions, then the reason that wait/notify exist on Object should be obvious. So, which of the above are "no"?

  • 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

  • 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

  • Why isn't Java letting me change the background color of the current panel?

    Basically, I am just trying to learn all there is about interactive mouse gestures and am attempting to build some sort of frankenstein-ish paint program.
    Here is the code:
    import java.awt.Color;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    public class MyPaint extends JPanel
        JButton button;
        JFrame frame;
        int currentX;
        int currentY;
        int counter = 1;
        public MyPaint()
            createComponents();
            addComponentsToPanels();
            setFrameProperties();
            activateListeners();
        public void addComponentsToPanels()
            this.add(button);
        public void createComponents()
            button = new JButton("Button");
            button.setToolTipText("This is the first button");
        public void setFrameProperties()
            frame = new JFrame();
            frame.setSize(400,400);
            frame.setResizable(false);
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(this);
        public void activateListeners()
            MyMouseListener listener = new MyMouseListener();
            button.addMouseListener(listener);
            button.addMouseMotionListener(listener);
        private class MyMouseListener implements MouseListener, MouseMotionListener
            MyPaint myPaint = new MyPaint();
            public void mouseClicked(MouseEvent e) throws UnsupportedOperationException
                JOptionPane.showMessageDialog(null,"The mouse was clicked!");
            public void mousePressed(MouseEvent e) throws UnsupportedOperationException
                JOptionPane.showMessageDialog(null,"The mouse was pressed!");
            public void mouseReleased(MouseEvent e) throws UnsupportedOperationException
                JOptionPane.showMessageDialog(null,"The mouse was released!");
            public void mouseEntered(MouseEvent e) throws UnsupportedOperationException
                myPaint.setBackground(Color.RED); // why isn't this working? - I want the original panel to be red (not the newly created windows on top)
            public void mouseExited(MouseEvent e) throws UnsupportedOperationException
                myPaint.setBackground(Color.BLUE); // why isn't this working? - I want the original panel to be blue (not the newly created windows on top)
            public void mouseDragged(MouseEvent e) throws UnsupportedOperationException
                currentX = e.getX();
                currentY = e.getY();
                repaint();
            public void mouseMoved(MouseEvent e) throws UnsupportedOperationException // why is this only being called once?
                System.out.println("mouseMoved: " + counter);
                counter++;
        public static void main(String[] args)
            new MyPaint();
    }I would just like to know how to make the inner class set the background of the panel of the outer class of the same window instead of doing what I want but in a newly opened window.
    Any help in fixing this would be greatly appreciated!
    Thanks in advance!

    Thanks! I just wanted to add:
    In addition to commenting out MyPaint myPaint = new MyPaint() and removing the this keyword when dereferencing setBackground() in MyMouseListener , I also changed
    button.addMouseListener(listener);
    button.addMouseMotionListener(listener);
    into
    this.addMouseListener(listener);
    this.addMouseMotionListener(listener);
    so that the colour changes when you hover the cursor in or out of the panel instead of the button.

  • Why isn't java working for me in Lion 10.7

    No matter how many times I install the latest update... I need it to deposit checks at home, & am mystified.

    Dear Matt & X423424X,
    I have been using my bank's deposit-at -home for years, it requires a scanner & JRE, so that is why I am puzzled that Java seems to not be working- since installing that awful Lion. I have the note below from the console; (unfortunately I have no idea what it means !).
    X423424X wrote:
    Also check that Java is enable outside of the browsers.  Open Java Preferences (in Utilities) and make sure both checkboxes are checked in the General tab or just click Restore Defaults.
    I have done what you both suggested, thank you, but that didn't help.I have been reading the other posts about Lion VS Java, & have done all that I could understand to do, from the wonderful mac expert advice: went into safari preferences & made sure Java was enabled; went into Java preferences & enabled the recommended settings; made sure I had the latest version & looked at it in Utilities; changed over to Firefox to see if it would work there: no.  So, I think my next step is to call in the computer tune-up person. I have been reading about Java vs Lion all night, & just feel sad that such a useful application is now a nightmare ( for the ordinary computer user, not the mac genius). Thank you.
    Java Plug-in 1.6.0_33
    Using JRE version 1.6.0_33-b03-424-11M3720 Java HotSpot(TM) 64-Bit Server VM
    User home directory = /Users/sharon
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    Java Plug-in 1.6.0_33
    Using JRE version 1.6.0_33-b03-424-11M3720 Java HotSpot(TM) 64-Bit Server VM
    User home directory = /Users/sharonCurrent Java version: 1.6.0_33

  • JDK 6u20, why isn't Java DB always an option

    I'm perplexed. I went to use derbyclient.jar and couldn't find it on a Windows 7 system. After a bit of testing, I've observed the following behavior.
    On Windows XP: The installer shows the Java DB option to install, and derbyclient.jar is installed in ProgramFiles\Sun
    On Windows 7 (64 bit): the installer does not show the Java DB option in either the 32 or 64 bit installer. derbyclient.jar is not installed anywhere on the system.
    So, what am I missing here?
    Thanks!

    While the article you mentioned does a nice job of introducing JDBC, the only thing it mentions about installation is:
    Java DB, which is available with most Java Development Kit download bundles, Java EE download bundles, or as a separate download, is a robust relational database based on Apache Derby.
    I'd like to know why the same JDK installation executable lets you install Java DB on XP, but doesn't give you the option on Windows 7. This isn't about a jar in a classpath, or how to use JDBC, it is about the lack of installation options provided by the same installation executable.

  • Why isn't java working with safari 5.1?

    I've been playing an online game lately that is powered by java. I saw there was a software update for my mac (os x lion i think) so i updated the software on my computer. Now, Java does not run on my computer, and i dont know how to downgrade to the safari software that i had before. Can somebody please help? This is really stressing me out.

    I have just found out from the Scifinder site at
    http://libinfo.wordpress.com/2011/07/27/scifinder-web-java-plug-in-available-for -safari-5-1/
    that Apple fixed this with a download, dated 20 July 2011;
    Here is the link: http://support.apple.com/kb/DL1421
    After quitting all browsers and installing the dmg, Safari 5.1 still wouldn't work with it until I re-started my computer - perhaps this just flushed a cache and I could perhaps have had the same result just from flushing caches.
    If Apple would only look at these threads and inform us!
    But I suppose by now most of you have found this anyway.

  • Why isn't Java Script available on Firefox desktop browser?

    I'm trying to watch a movie from www.letmewatchthis.com, it keeps telling me to update Java. Even though I have updated it, I'm still not able to watch anything from that website. Can someone please tell me how to fix this?

    Duplicated topic, please, continue in [https://support.mozilla.org/questions/1040990 questions/1040990]

  • Help! How to convert an instance from java.lang.Object to a particula class

    * How to convert an instance from java.lang.Object class to a particular class
    witch is known only at the running time?
    Roster EJB component is make up of RosterHome, Roster and RosterBean.
    RosterHome is the home interface of Roster EJB.
    Roster is the remote interface of Roster EJB.
    RosterBean is the implement of Roster EJB.
    The following code segment is to invoke Roster EJB component.
    String jndiName="roster.RosterHome";
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    RosterHome home =
    (RosterHome)javax.rmi.PortableRemoteObject.narrow(objref,
    RosterHome.class);
    Roster myRoster = home.create();
    String team="T1"
    String player="Tom"
    myRoster.addPlayer(player,team);
    But, now, all the home interface, the remote interface and the JNDI Name of
    Roster EJB component are not been known at the compiling time. However They are
    known at the running time, throught reading from the XML config file.
    Questions:
    1,How to write code for this case ? or
    2,How to convert an instance from Object class to a particular class witch is known
    only at the running time?
    String jndiName="roster.RosterHome";// in fact, reads from XML file.
    String homeClassName="roster.RosterHome";// in fact, reads from XML file.
    String remoteClassName="roster.Roster";// in fact, reads from XML file.
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    Object objHome= javax.rmi.PortableRemoteObject.narrow(objref,
    Class.forName(homeClassName));
    /* how to do next?
    }

    I am not sure what you are trying to do. But at some point you should know which methods to call on the remote interfaces. Maybe the method names are stored in the XML file as well or you have a set of standard method names (also consider parameters).
    However, this can be solved by reflection. Look at the java.lang.reflect package, especially java.lang.reflect.Method, and also at java.lang.Class.
    If you are doing this on the app server:
    I've seen posts where people say that reflection is not permitted in EJB, but I don't think so. Check the EJB spec.
    If you are doing this in an application: reflection is always permitted. Probably also in applets and JSP.

  • Using java.lang.Float.class causing Cannot format given Object as a Number

    hi,
    I have table and its model is default table model.
    model = new javax.swing.table.DefaultTableModel(data,col) {Class[] types = new Class [] {
                    java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Float.class,  java.lang.Integer.class
                }; public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }};I want to force the user to enter float number to fourth column and integer number to fifth column. but I am gettin an error "Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Cannot format given Object as a Number" like this. cause of this error is "java.lang.Float.class". and when I use Integer instead of Float the is no problem. Could you please help ?

    It depends on model data.

  • Missing Object.class

    When I try to run the EditRecordHR.jws demo I get:
    Error: initialization error: oracle.ojc.symtab.LoadError: file java\lang\Object.class not found
    I installed Sun Microsystems J2DK 1.3.1.03 and J2DKEE 1.3.1 (both in the same direcotory) before I installed JDeveloper 9.0.2.829 (in a different directoy). I followed all of the install instructions for JDeveloper.
    I also installed J2EE from OTN.
    I also installed Java WebStart 1.0.1
    I cannot find a file named object.class on my computer anywhere.
    Where should this file be and what could have gone wrong in my install?
    TIA,

    Edward,
    We've heard about this problem before but couldn't figure out why it was happening. In order for us to find and fix the problem, I will need a bit of help from you. I need to send you a special version of the compiler that will help me figure out this case. For that I need to know what version of JDeveloper you are running, in the about box, the full version INCLUDING the build number is there, I need all this information. I would also need your email address to send you some additional stuff.
    If you don't want to post you email address on this forum, please send the information to
    [email protected] with 'For Michel Trudeau' as the subject.
    Thanks,
    Michel

  • Forte compilation returns Object.class incorrect version 48

    Java programs that compile successfully fail in Forte CE V3.0 and return messages "Class file java/lang/Object.class has incorrect version 48, should be 45, 46 or 47". Does anyone know what this means and how it can be overcome?
    Thanks

    It means that the rt.jar in your classpath is more recent than the compiler Forte is using.

  • Object.class not found for JDeveloper For 11.5.102CU (Patch 4573517)

    Hi,
    we've just upgraded to 11.5.10 CU2 and I have downloaded new jdeveloper (4573517). On tryinmg to rebuild Tutorial.jpr I get compilation error "Initialization error. File java\lang\Object.class not found on classpath". JDEV_USER_HOME is set correctly to C:\OAJDEV11510\jdevhome\jdev and appears to be picked up in classpath settings below.
    Full compilation error below:
    Error: initialization error: file java\lang\Object.class not found on classpath C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\rt.jar;C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\i18n.jar;C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\sunrsasign.jar;C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\jsse.jar;C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\jce.jar;C:\OAJDEV11510\jdevhome\jdevbin\jdk\jre\lib\charsets.jar;C:\OAJDEV11510\jdevhome\jdev\myclasses;C:\OAJDEV11510\jdevhome\jdev\myhtml\WEB-INF\lib\datatags.jar;C:\OAJDEV11510\jdevbin\jdev\lib\jdev-rt.jar;C:\OAJDEV11510\jdevbin\jdbc\lib\classes12.jar;C:\OAJDEV11510\jdevbin\jdbc\lib\nls_charset12.jar;C:\OAJDEV11510\jdevbin\jlib\jdev-cm.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jmt.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\collections.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jct.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\xmlparserv2.jar;C:\OAJDEV11510\jdevbin\j2ee\home\lib\jndi.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jctejb.jar;C:\OAJDEV11510\jdevbin\j2ee\home\lib\ejb.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jmtejb.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jhtml.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\datatags.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4juixtags.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4j_jclient_common.jar;C:\OAJDEV11510\jdevbin\BC4J\jlib\bc4jctvb.jar;C:\OAJDEV11510\jdevbin\vbroker4\lib\vbjorb.jar;C:\OAJDEV11510\jdevbin\j2ee\home\lib\ojsp.jar;C:\OAJDEV11510\jdevbin\j2ee\home\jsp\lib\taglib\ojsputil.jar;C:\OAJDEV11510\jdevbin\j2ee\home\oc4j.jar;C:\OAJDEV11510\jdevbin\j2ee\home\lib\servlet.jar;C:\OAJDEV11510\jdevbin\jdev\lib\ojc.jar;C:\OAJDEV11510\jdevbin\jakarta-commons-el\jsp-el-api.jar;C:\OAJDEV11510\jdevbin\jakarta-commons-el\commons-el.jar;C:\OAJDEV11510\jdevbin\jakarta-commons-el\oracle-el.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\regexp.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\share.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\sax2.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\uix2.jar;C:\OAJDEV11510\jdevbin\mds\lib\mdsrt.jar;C:\OAJDEV11510\jdevbin\jdev\lib\mdsdt.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\oamdsdt.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\fwkjbo.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\fwk.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\wf.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\ak.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\flex.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\aolj.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\collections.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\appsSSO.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\concurrent.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\oamMaintMode.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\wsp.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\fwkCabo.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\diagnostics.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\biamlocal.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bipres.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bicmn.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bidatasvr.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bidataclt.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bidatacmn.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\biext.jar;C:\OAJDEV11510\jdevbin\bibeans\lib\bicmn-nls.zip;C:\OAJDEV11510\jdevbin\bibeans\lib\bipres-nls.zip;C:\OAJDEV11510\jdevbin\bibeans\lib\bidata-nls.zip;C:\OAJDEV11510\jdevbin\bibeans\lib\olap_api_92.jar;C:\OAJDEV11510\jdevbin\BC4J\lib\bc4jdomorcl.jar;C:\OAJDEV11510\jdevbin\BC4J\jlib\bc4jdatum.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\rosettaRt.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\cacheFwk.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\jttComn.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\iasjoc.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\pat.zip;C:\OAJDEV11510\jdevbin\jdev\appslibrt\portalFlexComps.jar;C:\OAJDEV11510\jdevbin\jdev\appslibrt\svc.zip;C:\OAJDEV11510\jdevbin\BC4J\jlib\bc4jtester.jar;C:\OAJDEV11510\jdevbin\lib\xmlparserv2.jar;C:\OAJDEV11510\jdevbin\jlib\help4-nls.jar;C:\OAJDEV11510\jdevbin\jlib\help4.jar;C:\OAJDEV11510\jdevbin\jlib\share.jar;C:\OAJDEV11510\jdevbin\jlib\jewt4-nls.jar;C:\OAJDEV11510\jdevbin\jlib\jewt4.jar;C:\OAJDEV11510\jdevbin\jlib\oracle_ice5.jar

    RT.JAR Files as mentioned in the Error log is not in the Directory ( you can verify)
    Usually rt.jar is in
    jdevbin\jdk\jre\lib.. Check the JDEV_USER_HOME variable and also the Libraries under Project Setting of JDEV , when you click on any specific lib it show you a path in the class path section..verify the same.
    Thanks,
    Sunit

Maybe you are looking for