Anyone else having problems with the 1.5 beta?
From: Jim (jkorman_at_alltel.net)
Date: 02/29/04
- Next message: Sudsy: "Re: runtime error reading data from text file"
- Previous message: Tom N: "Re: Transparent BG for loaded Image"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 29 Feb 2004 04:34:19 GMT
I have tried the following code
import java.util.*;
public class FirstTest {
public static void main(String [] args) {
ArrayList<String> a = new ArrayList<String>();
a.add("I");
a.add("hope");
a.add("that");
a.add("this");
a.add("works");
for (String s : a) { System.out.println(s); }
}
}
and get the following errors from the compiler
C:\JavaSource\Java_1.5>javac FirstTest.java
FirstTest.java:8: '(' or '[' expected
ArrayList<String> a = new ArrayList<String>();
^
FirstTest.java:16: ';' expected
for (String s : a)
^
FirstTest.java:20: illegal start of expression
}
^
3 errors
*******************
I was going to post the above problem, then found the
solution. Just to pass on the above code seems to
want
C:\JavaSource\Java_1.5>javac -source 1.5 FirstTest.java
Then it compiles and runs fine.
?? Is there an environment variable that needs to be set??
Jim
- Next message: Sudsy: "Re: runtime error reading data from text file"
- Previous message: Tom N: "Re: Transparent BG for loaded Image"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|