Solved

incompatible

Posted on 2004-08-17
8
860 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

623 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