Need help! something wrong in my code
Hi!
I got this program. I need to count how many black pixels are there in the row 12.It should give me the answer 4.
I believe everything is ok i just can get the final results cos im getting this error:
File: E:\java2\Amediumtry.java [line: 15]
Error: E:\java2\Amediumtry.java:15: cannot return a value from method whose result type is void
THATS THE PROGRAM:
import java.io.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
public class Amediumtry{
public static void main(String[] argv)
throws Exception{
int acc =0;
BufferedImage bi = ImageIO.read(new File("E:\\java2\\image2.png"));
for (int i=0; i<32; i++){
if (bi.getRGB(i,12)==0xFF000000){
acc ++;
break;}
return(acc);
}
}
}
Can someone explain me whats going wrong and where should i look for a solution?
Please