어떻게 입력 해야 결과물이 나올수 있을까요?
```
import java.util.ArrayList;
public class Main {
public static void main(String[ ] args) {
// input
String keyword = args[0];
// array list
ArrayList<Student> students = new ArrayList<Student>();
students.add(new Student(1, "황기태", 모바일, 4.1 ));
students.add(new Student(2, "이재문", 안드로이드, 3.9));
students.add(new Student(3, "김남윤", 웹공학, 3.5));
students.add(new Student(4, "최찬미", 빅데이터, 4.25));
// print
for (Student s : students) {
s.prettyPrint();
}
// search
for (Student s : students) {
if (keyword.equals(s.getName())) {
System.out.println(s.toString());
}
}
}
}
class Student {
private int number;
private String name;
private _________ department;
private double gpa;
public Student(int number, String name,_________department ,double gpa) {
this.number = number;
this.name = name;
this.department = department;
this.grade = gpa;
}
public String getName() {
return name;
}
public String toString() {
return String.format("%d, %s, %.2f", number, name, department, gpa);
}
public void prettyPrint() {
System.out.printf("학번: %d\n", number);
System.out.printf("이름: %s\n", name);
System.out.printf("학과: %s\n", department);
System.out.printf("평균: %.2f\n", gpa);
System.out.println("=====================");
}
}
```
[1]: http://%EB%AC%B8%EC%A0%9C
sehongpark님의 답변
언더바 친 부분에 `String`을 넣으세요.
## Scanner 입력
스캐너를 통한 입력시 아래를 참고.
```
// 변경 전
String keyword = args[0];
// 변경 후
Scanner input = new Scanner(System.in);
String keyword = input.next()
```