0
YouTube에서 튜토리얼을 수행하면서 "this.path"와 같은 것을 사용해야하는 부분에 도달했을 때 오류가 발생하는 것 같습니다. 나는 이것에 대한 해결책을 찾지 못하고있다. 당신은 if
문 다음에 추가 세미콜론이Java 도달 할 수없는 코드 오류
if(image == null);{
return;
}
: http://www.youtube.com/watch?v=o7pfq0W3e4I
package gfx;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
public class SpriteSheet {
public String path;
public int width;
public int height;
public int[] pixels;
public SpriteSheet(String path) {
BufferedImage image = null;
try {
image = ImageIO.read(SpriteSheet.class.getResourceAsStream(path));
} catch (IOException e) {
e.printStackTrace();
}
if(image == null);{
return;
}
this.path = path;
this.width = image.getWidth();
this.height = image.getHeight();
pixels = image.getRGB(0, 0, width, height, null, 0, width);
for(int i = 0; i <= pixels.length;i++){
pixels[i] = (pixels[i] & 0xff)/64;
}
for(int i = 0;i <= 8;i++) {
System.out.println(pixels[i]);
}
}
}
오류 메시지를 게시 할 수 있습니까? – michaelt