Solved

incompatible

Posted on 2004-08-17
8
850 Views
Last Modified: 2012-06-21
Hi experts,
this line is giving me an error:
 List list = new ArrayList();

I get : incompatible types;found   : java.util.ArrayList,required: java.awt.List at line 1445, column 17

whats the problem?
0
Comment
Question by:Samooramad
  • 4
  • 2
  • 2
8 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11819498
Cast the "list" to a List when you pass it to the method call:

(List) list
0
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 250 total points
ID: 11819522
>> List list = new ArrayList();

You don't need to cast, as the ArrayList implements the java.util.List

>> java.util.ArrayList,required: java.awt.List at line 1445, column 17

But java.awt.List is imported wrongly in your code.
So remove that import and change that to java.util.List
0
 
LVL 35

Expert Comment

by:girionis
ID: 11819555
Nice catch :)

Yes mmuruganandam ir right, it is expecting an awt not a util list. You either need to pass a java.awt.List or chaneg the parameter method to accept a java.util.List.
0
 

Author Comment

by:Samooramad
ID: 11819558
I dont pass it. I just use it in a method. Im also getting error for these lines:

list.add(myArray[i]);

return (myClass[]) list.toArray(new myClass[0]);

both give me cannot resolve symbol method
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Samooramad
ID: 11819577
yep that worked :)
thank you
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 150 total points
ID: 11819582
You can only add String to a java.awt.List.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 11819588
cool ;)
0
 
LVL 35

Expert Comment

by:girionis
ID: 11819628
:)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
allStar challenge 1 41
topping2 challenge 13 59
Running Jira on Raspberry PI 2? 3 127
Java - Why doesn't this JFrame work 3 18
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now