I want to display an image with drawn lines on a map, and separate images made for every single section in the image (several connected lines). I have written this code:
Return type of the method is BufferedImage
But you try to return array of BufferedImage. That is thy the error occurs.
BTW: do you really have 2 return statements?
some people may find confusing when they don't know that
BufferedImage lineImage1[] = null;
is the same as
BufferedImage[] lineImage1 = null;
and you cannot have two returns, it's illegal in Java.
So if you want to return more than one object, you can do something like
public Object[] getLineImage() {
(...)
Object[] o = new Object[2];
o[0]=lineImage;
o[1]=lineImage1;
return o;
}
lineImage1
is defined as BufferedImage lineImage1[]
, which is an array of BufferedImages. The return value of the method is BufferedImage
.
You either want to change the return type to an array of BufferedImage
s, or only return a single BufferedImage
.