1.4 and 1.5

I'm in a class where we are learning Java at 1.4.

Everyone is wondering if we shouldn't be doing this at 1.5.

Is release 1.5 in major use?  Are the changes significant?
Comments.  To be shared with class and instructors.

Who is Participating?
stefanfreyrConnect With a Mentor Commented:
I very much appreciate the decision your teacher made. The problem is that the teacher must know the material before teaching it and I doubt that he/she has had time to fully inspect whether all the assignments will work properly in the new version of Java. I tought a course that used Java (it was more of a coding patterns/design course though... not a programming course) and this is exactly the decision we made as well. We didn't feel comfortable handing out assignments that we had not tested properly with the new Java.

That being said, we did allow people to use Java 5 if they wanted to. We just made absolutely clear that it would be the students responsibility.

My oppinion is that while you're in school, that's the right time to experiment and have fun with what you're doing. If you're very interested in the Java programming language I suggest you take a look at Java 5 but I would not suggest that you do so when finishing your assignments! Do it on your own free time and when/if you feel comfortable enough with it you might decide to use it for one of your assignments but realize that if it fails, it's your bad!

If you want my opinion on whether Java 5 is likely to work on an assignment... well... that depends on the assignment. Doing simple Java applications like the ones you're likely to do in a beginners course in programming will work (the palindrome checker etc.). If, however, you're doing more complex assignments (such as a client-server application or a J2EE application) you might run into problems. Also, if you're using any external libraries (jar files) in your assignments you might have problems.

Java 5 is not in widespread use but I believe that many startup projects are using it, projects that have not yet been put into production (that's the case with my project at least).

Java 5 did introduce a bunch of new features such as:
    int i = 2;
    Integer a = i; //This wasn't possible in Java 2 since i is not an instance of Integer.

foreach loops:
    Collection col = getSomeCollection();
    for( Object item : col )
    { // Iterates through all items in col using the item variable

    Collection<MyClass> col = new ArrayList<MyClass>();
    col.put( new MyClass() );
    col.put( "test" ); //this will fail since the compiler will check for the type that this collection accepts
    col.get( 0 ); //this returns a MyClass instance which will save you a lot of "casting"

variable arguments:
    public void method( String ... args ){
        // args is actually a String[] and can be used as such:
        System.out.println( args.length );
    // The following all call the above method.
    method( "foo" );
    method( "foo", "bar" );

In addition to such "syntax and semantics" changes, some changes were made to the JVM itself as well. For example, it is now supposed to be able to share the Java class library between JVMs, therefore reducing memory usage. This feature has been reported to be not functioning properly though.

Well, I hope I answered your question here but one fact remains: You shouldn't be too worried about which version of Java you're using in your class. The programming language is just a tool to teach you the basics of programming. If you would "learn" Java 5 in your course, you'd have to learn a new version before you finished school because Sun will release it. So in your course... try to learn "programming" instead of a "programming language", that will prepare you much better for the real world.
Mayank SAssociate Director - Product EngineeringCommented:
Have a look at the release-notes. A lot of features were introduced by 1.5 like generics, boxing/ un-boxing, foreach iterators, type-safe enums, etc:

hank1Author Commented:
Seems significant.  We're studing containers right now.
I see the montra 'no primitives' is over with.
Wonder why we're here at 1.4.  I see release is about
a year old.  Thanks

... and generics -  
hank1Author Commented:
Is this release in wide spread use?  Or will it take
years before it's common enough to use 'generally'.

If you want to  ....

Just what kind of an upgrade does the client have to
perform to use code developed under 1.5?
Can you just plop 1.5 classes on a 1.4 box?
Mayank SAssociate Director - Product EngineeringCommented:
>> Is this release in wide spread use?  

Not entirey but people are switching to it.

>> Just what kind of an upgrade does the client have to
>> perform to use code developed under 1.5? Can you just plop 1.5 classes on a 1.4 box?

I don't think that would work. You probably need to re-install the JRE because the VM's internal behaviour might differ too.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.