try {
try {
Image img = ImageIO.read(new File("target.png"));
String imgpath = "target.png";
} catch (IOException e) {
e.printStackTrace();}
} finally {
int width = img.getWidth();
int height = img.getHeight();
}
}
I have already created "img" in this line:
Image img = ImageIO.read(new File("target.png"));
But when I want to get the dimensions of "img" in these lines;
int width = img.getWidth();
int height = img.getHeight();
it gives me this error: img cannot be resolved
Could anyone tell me what I did wrong pls