Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » New to Java(Im new please tell me what is wrong with my code)
New to Java [message #1814345] Tue, 10 September 2019 02:26 Go to next message
Logan Jackson is currently offline Logan JacksonFriend
Messages: 1
Registered: September 2019
Junior Member
import java.util.*;

public class ArrayListExample2 {

public static void main(String[] args) {

List<String> list_Strings = new ArrayList<String>();
list_Strings.add("Red");
list_Strings.add("Green");
list_Strings.add("Orange");
list_Strings.add("White");
list_Strings.add("Black");

for (String element : list_Strings) {
System.out.println(element);
}
}
}

ArrayList wont run with the argument <String> and I dont know why?
Re: New to Java [message #1814352 is a reply to message #1814345] Tue, 10 September 2019 06:07 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Do you specify Java 1.5 or higher in Window -> Preferences -> Java -> Compiler's "Compiler compliance level"? I assume that in the Java preferences, JRE section you have a 1.8 JRE available? You might want to read https://www.vogella.com/tutorials/Eclipse/article.html

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Installation error
Next Topic:Startup Issue on Pi
Goto Forum:
  


Current Time: Sat Apr 20 03:17:07 GMT 2024

Powered by FUDForum. Page generated in 0.08067 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top