1

What does error: ArrayList cannot be resolved to a type mean in dr java?

2
  • By "dr java", are you referring to the tool named DrJava? Don't worry about mentioning that particular tool. Simply mention Java and people will understand what you're talking about. :) Commented Mar 28, 2011 at 16:07
  • The OP asked a dupe-like followup question, of sorts, here: stackoverflow.com/questions/5461699/java-errors-in-dr-java Commented Mar 28, 2011 at 16:37

2 Answers 2

8

You probably need to add the line

import java.util.ArrayList;

To your source file. Post the code to be sure.

Sign up to request clarification or add additional context in comments.

9 Comments

okay. I did add that to my code but it gave me a lot of different errors
Sorry. I am new to java and I really don't know much about it. So I am lost and trying to understand
Add some more imports for every flavour of this kind of error that you get, then try to reduce the errors down to a small sample program and post a question with the code. Hopefully people will be able to help!
Coding is hard but this is my first experience with it. I have never encountered it before. I am willing to learn that is all that matters. Yes, I may not get it right now but with the right tools and my motivation to keep trying and people helping me I will get there. Not everyone in coding stated out great. They had to learn just as I do.
Yeah, times change and things change. Asking for help doesn't mean that I can't do it or that I'm not trying. I don't care if you think I can or can't do it. I know that I can if I keep trying. Anyone can do anything if they set their mind to it. My mind is set and you make it sound like a crime if anyone ever has a question about anything. Not everyone learns the same, so think what you want.
|
1

It usually means you have forgotten to import the class. Near the top of you java file, put

import java.util.ArrayList;

3 Comments

okay. I added that in and got these two errors back: error: the type of the expression must be an array type but it resolved to java.util.ArrayList<java.lang.Integer> and error: length cannot be resolved or is not a field?
ArrayList doesn't have a length attribute (its not an array) You may have intend to use size().
@Leasha take a look at the ArrayList documentation: download.oracle.com/javase/6/docs/api/java/util/ArrayList.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.