Hi, thank you in advance.
I'm struggling with lesson number 10 and "ArrayList cannot be resolved to a type" I've removed the test and java class and entered the code in twice but i cant spot the issue.There is also an issue with how the import of the ArrayList is resolved. Please help I'm sure it's simple but I just can't see it at the moment. have enclosed a jpg where i am WRT the video and my errors.
thank you again.
Hi. I'm not sure what the problem is. What does Eclipse tell you when you right-click on the error and try quick fix? The code looks fine and works for me in the latest Eclipse version (3.7.2). What version of Java are you running? I'm testing with jre6. Good luck. Mark
Hi Mark thank you for the reply, I didn't see it until now, I had ticked the monitor box but got no e mail. I'm using Eclipse Platform is Version 3.7.1.r37 .
When tried "quick fix" there were no options, I reentered the code and I have several options, for example "Create a Class "ArrayList" I'm going to start Lesson 10 again from scratch and check the errors again.
When I check in program files I see that I have two entries under Java,
Java 6.0.290 (94MB)
Java 7.0.2 (64-bit) (93.6MB)
I'm sorry but I don't know which one is running at a particular time.
Thank you for the response Mark.
I'll report back after I attempt Lesson 10 from scratch.
When I'm creating the ml.books and people fields I get different code to you, this results in an error remaining here
assertTrue(ml.books instanceof ArrayList);
under ml.books after I have used quick fix and created the fields.
When I am finished dealing with the compiler errors, saving as I go the code i have in the MyLibrary.java class looks like this
public String name;
public ArrayList books;
public java.util.ArrayList people;
I also noticed on the tutorial that you have the following set up
Jre System Library (jre 1.6.0_01)
Jre System Library (javaSE1.7)
I never mentioned it in my above post but I have that in my program files too. I'm going to uninstall it and see if Eclipse sports either of the other two version of Java I have there.
thank you again, I hope this is a java version issue as I've lost about a week on this now LOL.
I ran into this same issue and it was driving me crazy!
I use eclipse indigo 2 (1.4.2) and JavaSE 126.96.36.199
The issue is when you try to create a field using the 'quick fix' on the MyLibraryTest class, it creates an "Import ArrayList' value on the MyLibary class. Then when you Import the ArrayList class, it creates "import java.util.ArrayList;".
What I did to fix this issue was manually delete the "Import ArrayList' in the MyLibrary java class after I used the quick fix to create a field for the ml.books.
Alternatively, you should be able to import the ArrayList first then create the fields and you shouldn't end up with this secondary import ArrayList statement in your MyLibrary class.