wood burning stoves
The moose likes Java in General and the fly likes incompatible types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "incompatible types" Watch "incompatible types" New topic
Author

incompatible types

sneha krishna
Greenhorn

Joined: Nov 29, 2011
Posts: 7
In my class, at the line

for (String coveredTestCase : getCoveredQCTestCases()) {

I am getting this error

TestBase.java:122: error: incompatible types
for (String coveredTestCase : getCoveredQCTestCases()) {

required: String
found: Object

Please help me how to debug this error.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63211
    
  69

What does getCoveredQCTestCases() return?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aj Maven
Greenhorn

Joined: Jul 04, 2011
Posts: 22

Method getCoveredQCTestCases() seems to return an object. Check its return type first. Anyways you can convert the object to string by calling toString(). But know what the method is returning first.


Thanks
-Aj
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20079
    
  30

Not Object but something that's an Iterable<Object>, Iterable<?> or Iterable (raw type). That Iterable could be a Collection, List, Set, etc. My guess is that the method does not use generics yet.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: incompatible types
 
It's not a secret anymore!