Solved

incompatible

Posted on 2004-08-17
8
854 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 36
java jdbc batch example 8 33
Configure a Bean in an XML file 4 31
printf performancy 11 39
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
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 …

770 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