Solved

incompatible

Posted on 2004-08-17
8
858 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
going to wrong jsp page 2 47
SequenceInputStream example 3 21
Need Help! Getting a syntax error and don't understand why 3 39
java mysql insert application 14 44
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

749 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