1005번 - ACM Craft
아래 2가지의 경우
런타임 에러가 발생하거나 or 발생하지 않습니다. 이유가 무엇인지요? ㅠ
1) 런타임 에러 발생하지 않음------------------------------------------------------------------------------------------------------------------
public class Main {
....
static boolean[] visited = new boolean[1001];static int[] cost = new int[1001];....
public static void main(String[] args) throws IOException {
2) 런타임 에러 발생------------------------------------------------------------------------------------------------------------------
public class Main {....static boolean[] visited;static int[] cost;....public static void main(String[] args) throws IOException {
....visited = new boolean[N + 1];cost = new int[N + 1];
댓글을 작성하려면 로그인해야 합니다.
stack 7년 전 1
아래 2가지의 경우
런타임 에러가 발생하거나 or 발생하지 않습니다. 이유가 무엇인지요? ㅠ
public class Main {
....
static boolean[] visited = new boolean[1001];
static int[] cost = new int[1001];
....
public static void main(String[] args) throws IOException {
....
public class Main {
....
static boolean[] visited;
static int[] cost;
....
public static void main(String[] args) throws IOException {
....
visited = new boolean[N + 1];
cost = new int[N + 1];