이클립스로 푸는데 자꾸 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 오류가 납니다..ㅠ
어떻게 고쳐야 하나요?
public class Salary {
public static void main(String[] args) {
// 객체 생성
Developer tom = new Developer("Tom", Integer.parseInt(args[0]));
Developer john = new Developer("John", Integer.parseInt(args[1]));
Developer sally = new Developer("Sally", Integer.parseInt(args[2]));
// 연봉 출력
System.out.println(tom.salary());
System.out.println(john.salary());
System.out.println(sally.salary());
}
}
class Developer {
/* 1. 필드를 구현 하시오. */
private String name;
private int career;
/* 2. 생성자를 구현하시오. */
public Developer(String name, int career) {
this.setName(name);
this.career = career;
}
/* 3. 메소드를 구현하시오. */
public int salary() {
if (level() == "초급") {
return 2800+(100*this.career);
} if (level() == "중급") {
return 3500+(100*this.career);
} if (level() == "고급") {
return 4500+(100*this.career);
}
return career;
}
public String level() {
String level = "";
if (this.career < 3) {
return "초급";
} else if (this.career < 7) {
return "중급";
} else {
return "고급";
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
sehongpark님의 답변
## args 값
입력 값을 직접 넣어보세요
```
Developer tom = new Developer("Tom", 3);
Developer john = new Developer("John", 5);
Developer sally = new Developer("Sally", 9);
```