Which classes are inherent in the Java language?

For some reason I just thought of the question this past 2AM.
What classes are significant to the Java compiler? The list I thought of was:
Object -- implements wait() and synchronized
String -- all those convenience idioms we couldn't live without
StringBuilder -- for String operators like "a" + var
Integer, Long, Short, Char -- also for String operators like int i; String x = "abc" + i;
Throwable -- needed for catch clause
RuntimeException -- needed for implicit throw
How about the following? Does javac need to know about these? Or are they all handled by the runtime base classes?
Class
Constructor
Thread

AlanObject wrote:
jverd wrote:
ErrorI've never run into this class before, but wouldn't the JVM and not the compiler be dealing with this?> I don't think it has to know about StringBuilder or StringBuffer, as the JLS does not require their use for string concatenation with +. It's just that most implementations do it that way.Good point.
I don't doubt that in the creation of Java there were long discussions about this. They could have done away with the String-awareness of the language by forcing the use of direct methods but the usability issue won the day.
Also, are there now classes implied in the use of the for-each statement (Collection?) and in enums (Enumeration?)That would be Iterable, a shiny new abstraction. And, by extension, Iterator. Both them and enums, though, are tricks of the compiler, syntactic sugar. There's no new bytecode for those mechanisms (as yet)

Similar Messages

  • How many classes are there in the java kit?

    i figured this was the most "general" forum to post this question in. and im curious to know, how many packages/classes/functions are there in the java sdk? like, all the prebuilt ones. ive looked but cant seem to find any info on it. anybody happen to know?
    Thanks!

    there are at least 4142 classes in the 1.4.2.x distribution ...Is that the number of files which end in .java? There's bound to be a lot more
    classes, when you u consider inner classes and especially anonymous
    inner classes.It was just a rough estimation ... and I wrote 'at least' 4142 classes ...
    and I was wrong: there are alse 4 .h files in the src.zip file, so that makes 4138
    classes at least :-)
    kind regards,
    Jos

  • Some changes we need in the Java language

    Dear Java language makers,
    I'm actually coding a fairly complex program, and I'm facing several issues c++ does solve while Java doesn't handle them. I strongly wish these features could be included in next editions of the Java language, and I think I'm not the only one...
    1) Friend Class access
    Say I have a parser and a Data structure. The parser reads a file, and updates another class (being a data structure) as it parses line by line an input text file.
    I want my parser to fill up the data structure step by step, that is field after field, rather than using a constructor, because the information appears sequentialy in my text input file.
    Using a constructor to intitialize my data structure (rather than field by field access on a void object)would require me creating several variables in my parser for buffering the information, then create my object. This results in a loss of coding performance, and execution performance (spending time allocating and killing buffer values).
    On the other hand, I don't want these field values to be exposed to the users of my SDK, I want them to be accessed thru accessor methods.
    You would answer me : put both classes in the same package, and declare the fields of the data structure "protected", and accessors "public".
    Yes, that is a solution...but if you do really think Object Oriented, this sucks. Because a data structure and a parser are not the same thing, and I want to have them in separate packages.
    one being named myApp.Datasets, the other being named myApp.Parsers.
    And this can't be done with Java.
    If only I could declare in my data structure class the Parser class as a Friend Class, this would solve the issue and be CLEAN for Object Oriented programming !
    2) Operators
    This very annoying the Java language doesn't support operators
    Say you have a Vector3D class and you want to make a calculation :
    in c++, you can define operators for your class, and make a calculation like this :
    float a;
    Vector3D v1,v2,v3;
    //calculation
    v1 = v2 - v3 * a; //clean and easy to read
    Now in Java, not having operators, you have to deal with functions :
    float a;
    Vector3D v1,v2,v3, tmpv;
    v1=new Vector3D();
    tmpv=new Vector3D();
    //calculation
    tmpv.sub(v2,v3);
    tmpv.mul(a);
    v1=tmpv; //dirty and unreadable
    In Java you get 3 lines for a basic calculation. This is the way it's implemented in JAVA3D, and this is the best you can do in Java to my opinion.
    Just imagine how math code looks in java when you code a 3D Physics engine, regarding the previous exemple, and having to deal with matrices, vectors, quaternions...Well I give you a taste, a simple slice of the code :
    vtmp.cross(Airplane.vAngularVelocity,Element.vCGCoords); // rotational part
    vLocalVelocity = add(Airplane.vVelocityBody , vtmp);
    fLocalSpeed = magnitude(vLocalVelocity);
    if(fLocalSpeed > 1) vDragVector = div(negate(vLocalVelocity),fLocalSpeed);
    Vector3f v = new Vector3f();
    v.cross(vDragVector,Element[i].vNormal);
    vLiftVector.cross(v,vDragVector);
    tmp = magnitude(vLiftVector);
    vLiftVector=normalize(vLiftVector);
    v=new Vector3f(vDragVector);
    tmp = v.dot(Element[i].vNormal);
    Got it ? :)

    Because a data structure and a parser are not the same thing,
    and I want to have them in separate packages.Because a data structure and a parser are not the same thing, you should not jave them as the same type (class or interface), that is right. But this does not prevent us from putting them into the same package!
    java. lang.Integer and java.lang.String are not the same thing, but I am quite happy with them as classes in the same package.
    Put both classes in the same package, and declare the fields
    of the data structure "protected", and accessors "public".Protected access would allow access for inheriting classes as well. The default (package-wide) access would be better.

  • Which classes are required to run a basic client app outside of jDev?

    Basic question, folks.
    For a minimal program, say a frame and a swing component, which classes need be copied (to a system without any Oracle software installed) in order to run? Is there a listing available that describes which class/jars are needed if x component is used?
    Also, will jre 1.4 work? Or do I need to copy a special Oracle JVM? If so, is there a specific installer just for it?
    TIA
    -Nat

    Nathan,
    To run any Java application, you will need a Java Runtime Environment(JRE) which is part of the Java Software Development Kit (SKD). If you want to distribute your application with a JRE, you can copy the .../jdk/jre directory from JDeveloper (check the readme file about copyrights and other legal issues) or you download it from http://java.sun.com/j2se/1.3/download.html
    Both the AWT and Swing libraries are included in the JRE in the same jar file as the basic java.lang or java.io classes. The name of the file is rt.jar.
    If your program runs with the Oracle VM, it will run with Hotspot. Both VMs are equivalent when running your application. It is only for the development phase that we strongly suggest to use the Oracle VM because it is much better instrumented for development than any other VM.
    If you want to know precisely which classes are loaded from which jar files, run your application from a command line and add -verbose:class.
    For example:
    C:\JDev9\jdk\demo\jfc\SwingSet2>java -verbose:class -jar SwingSet2.jar
    - Cedric
    JDev. team

  • Which classes are implemented ?

    hi,
    is there a possibility that a javacard does not implement all javacard api classes ?
    if yes, then how can I know which classes are implemeneted, and which are not ?
    Kuba

    Sure that's possible.
    An example is that there are different javacards. One that implements RSA and one that just implements DES. Not only that, but the vendors can determine what key strengths they want to implement as well.
    Before you buy a kit find out by looking at the specs that detail what they are implementing.

  • How do I upload to Facebook in High Resolution using my iPhone. Do I need an app? Which ones are best for the job? (I know how to do it on a PC :) )

    How do I upload photos to Facebook in High Resolution using my iPhone. Do I need an app? Which ones are best for the job? (I know how to do it on a PC )

    100pat wrote:
    Thanks, I can do it fine from my Windows desktop PC, I just want to know how to do it from an iPhone4
    Like I said before ask facebook or look at their support site to see if that is even a feature.

  • How can i determine which devices are used at the moment?

    Hi all,
    I am designing an interface with LabVIEW for uing agilent devices. My work colleagues will use this interface.  I want to determine which devices are used at the moment and if I determine used device, i will add automatically device names to interface's main vi. So all my work colleagues can see on the program which devices are used by another colleague. This devices are connected with GPIB. İ want to learn is there any function on Instrument I/O palette.
    Thanks,
    Omer
    Solved!
    Go to Solution.

    Hi Omer,
    so those devices are connected to the PC with a GPIB connection. Will your collegues run several DAQ programs at the same time?
    GPIB-devices being controlled by PC don't have a "in use"-signal. They wait for commands, execute them and send an answer. When you start to control them using two programs they may respond to both programs, mixing up settings/measurement values and so on.
    That being said: In MAX you can see all devices connected to your GPIB port. You could scan the GPIB port using VISA commands in your program. You might even try to access a certain device by it's VISA alias. I really don't know if you will get a "device nopt available" error message when that VISA alias is in use by a different program - but you might do a quick test on your own…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Can i choose which songs are added to the itunes match library?

    can i choose which songs are added to the itunes match library?

    Hi,
    No. It is all or nothing.
    Jim

  • HT4914 How can you tell which songs are downloaded from the cloud on an ipad

    How can you tell which songs are downloaded on the iPad from the cloud?

    I know ipad albums are more like tagging photos rather than putting them in folders. I just have a nagging feeling I missed some pics and I have too many to try to go figure out one by one. I don't look at my photos from the camera roll, only from albums I tagged just because I imported photos from different sources and the dates and order is really messed up. I just want to know that I am viewing all the photos from like this vacation or that event and there's none I missed that are only in the camera roll.

  • Dynamic equivalent of the Java language CAST operator

    Hello,
    Here is what I want to do:
    I have an Object that contain "something" (I don't know at compilation time). And I want to do this call:
    Object myObject = new String("Hello");
    myMethod (myObject);
    having declared these:
    public void myMethod (Integer dInt);
    public void myMethod (String sString);
    I want the second method to be called. How can I do that?
    I'm looking for something like a dynamic equivalent of the Java language cast operator:
    ??? myMethod ( (myObject.getClass())myObject ); ???
    or ?? myMethod ( (myObject.castTo(myObject.getClass()) ) ; ??
    Thanks.

    How 'bout using the instanceof operator?
    Like this:
    public myMethod(Object obj)
    if (obj instanceof String)
    //do String stuff
    else if (obj instanceof Integer)
    //do Integer stuff
    }

  • How can i see which items are taking up the most disk space

    I have a Titanium PowerBook G4 with a 20GB hard drive. I'm currently using 15GB. I have tried searching through my hard drive to see which programs are taking up the most space. When I add up the totals of the various folders, etc., it's not 15GB worth. I feel like some items must be nested somehow, making them difficult to find. Is there some way to search your computer by size of items? I know that opening the hard drive and clicking on the size tab will sort things according to size. However, the folders don't show their size unless you click on them individually. Any suggestions?
    Thanks.

    While viewing a Finder window go to View>Show View Options, put a check in the box for 'Calculate All Sizes'. This is a setting you don't normally want to have turned on as it slows down the refresh when you switch windows, so you might want to remove the check once you identify the disk hogs.
    BTW- You can free up a lot of disk space & RAM if you remove any fonts that you & the OS don't really need. You may also have a great deal of space taken up by unnecessary printer drivers, not to mention the plethora of ReadMes & other 'goodies' that get added when you install software.
    HTH |:>)

  • ITunes can not sync apps to the iPhone because it can not be determined which apps are installed on the iPhone.

    Hello.
    I get this error message
    iTunes can not sync apps to the iPhone because it can not be determined which apps are installed on the iPhone.
    iTunes kann keine Apps mit dem iPhone synchronisieren weil nicht festgestellt werden kann welche Apps auf dem iPhone installiert sind.
    Need Help

    Basic troubleshooting is reset, restart, restore.  Have the first two been tried?
    How about simply unplugging the iPhone and plugging it back in to sync?
    What has been done in an attempt to troubleshoot the issue?

  • HT2729 I have downloaded a video on my iPhone but want to watch it on my iPad which both are connected to the same iTunes account but it hasn't shared to my iPad !?? When I try to download on my iPad says I've already purchased and would I like to buy aga

    I have download a video on my iPhone but want to watch it on my iPad which both are connected to the same iTunes account but it hasn't shared to my iPad !?? When I try to download on my iPad says I've already purchased and would I like to buy again ?

    Movies are not part of the automatic downloads feature. Apps, music and books only.
    If you live in the U.S. you can download many Movies again for free using the same Apple ID that you bought the movie with. If you do not live in the U.S, that feature is not available. Not all Movies are available at this time either.
    You can transfer the movie to iTunes on your computer and then sync it to the iPad if you like.

  • Which functionalities are available activating the EA-FIN extension?

    Hi All,
    cuold anyone tell me which functionalities are available activating the EA-FIN (Financials Extension) extension?
    and which ones are available activating the EA-FS (Financial Services) extension?
    Thanks
    G.

    hi
    check out the below link
    http://www.sapsolutionbrowser.com/Search.aspx

  • Converting string(which is an xml from the java side) to xml in flex

    Hi,
       I have an xml from the java side which i send as string over amf. I need to convert this to xmllist or xml and bind it to a tree. Could some one help me in doing this. My label field needs to be displayName
    this is my xml that comes as string to the flex side
    <Menu>
      <MenuItem>
        <id>1</id>
        <displayName>Add</displayName>
        <menuList>
          <MenuItem>
            <id>3</id>
            <displayName>Form1</displayName>
            <menuList/>
          </MenuItem>
          <MenuItem>
            <id>4</id>
            <displayName>Form2</displayName>
            <menuList/>
          </MenuItem>
        </menuList>
      </MenuItem>
      <MenuItem>
        <id>2</id>
        <displayName>Delete</displayName>
        <menuList>
          <MenuItem>
            <id>5</id>
            <displayName>Form1</displayName>
            <menuList/>
          </MenuItem>
          <MenuItem>
            <id>6</id>
            <displayName>Form2</displayName>
            <menuList/>
          </MenuItem>
        </menuList>
      </MenuItem>
    </Menu>

    Well, for Binding you will probably need to further convert to XMLListCollection or ArrayCollection.
    Not sure.
    However, that is the way to convert String to XML.

Maybe you are looking for