Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java 1.5 Beta Surfaces
Index -> Java
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Mon Feb 09, 2004 11:54 am   Post subject: Java 1.5 Beta Surfaces

http://java.sun.com/developer/technicalArticles/releases/j2se15/

The article describes the changes better than I can. Enjoy.

But I can't resist throwing out an example (astute Java programmers should notice a number of new things):

Java:
import java.lang.*;
import java.util.*;

class Test {
   public static int add(int ... args) {
      int output = 0;
      for (int i : args) output += i;
      return output;
   }
   public static void main(String[] args) {
      System.out.printf("%d\n", add(1, 2, 3, 4));
      ArrayList<Integer> arr = new ArrayList<Integer>();
      arr.add(0, 4);
      arr.add(1, 3);
      for (Integer i : arr) System.out.printf("%d - ", i);
   }
}
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Mon Feb 09, 2004 4:40 pm   Post subject: (No subject)

yes 1.5 is very exciting!!

i'll be modifying my bot code as soon as the release version of 1.5 is released.

i think the most exciting feature are the variable args, the enhanced for loop and auto-boxing.
wtd




PostPosted: Tue Feb 10, 2004 7:44 pm   Post subject: (No subject)

rizzix wrote:
i think the most exciting feature are the variable args, the enhanced for loop and auto-boxing.


It's all exciting.

You left off generics, which mean no casting... or exceptions related to that. The only thing I'd like from Nice (a language that compiles to JVM bytecode) is the functional side of things, like the ability to create anonymous functions/methods, and and the ability to simplify function syntax.

code:
int add(int a, int b) = a + b;


Of course, then I'd also like the ability to simplify parameters...

code:
-- in Eiffel
feature { ANY }
   add_four_integers(a, b, c, d : INTEGER): INTEGER is
      do
         Result := a + b + c + d
      end
Display posts from previous:   
   Index -> Java
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: