-2
는 //이 내 메인 클래스입니다캡슐화 (사용자 입력)
import java.io.*;
import java.util.*;
public class TheInnovator{
private String name;
private String age;
private String designation;
private String course;
private String yrlvl;
public TheInnovator(String name, String age, String designation, String course, String yrlvl){
this.name = name;
this.age = age;
this.designation = designation;
this.course = course;
this.yrlvl = yrlvl;
}
public void setName(String name){
this.name = name;
}
public void setAge(String age){
this.age = age;
}
public void setDesignation (String designation){
this.designation = designation;
}
public void setCourse(String couse){
this.course = course;
}
public void setYrlvl (String yrlvl){
this.yrlvl = yrlvl;
}
public String getName(){
return name;
}
public String getAge(){
return age;
}
public String getDesignation(){
return designation;
}
public String getCourse(){
return course;
}
public String getYrlvl(){
return yrlvl;
}
}
//이 내 홈페이지 드라이버
당신은=
기호를 제거 할 필요가
import java.util.*;
public class MainDriver{
public static void main(String args[]){
TheInnovator theinnov = new TheInnovator();
Scanner input = new Scanner(System.in);
theinnov.setName = (input.nextLine());
theinnov.setAge = (input.nextLine());
theinnov.setDesignation = (input.nextLine());
theinnov.setCourse = (input.nextLine());
theinnov.setYrlvl = (input.nextLine());
System.out.println("Name: " + theinnov.getName());
System.out.println("\nAge: " + theinnov.getAge());
System.out.println("\nDesignation: " + theinnov.getDesignation());
System.out.println("\nCourse: " + theinnov.getCourse());
System.out.println("\nYear Level: " + theinnov.getYrlvl());
}
}
는 C 번호'theinnov.setName은 (input.nextLine는()) = 아니다' –
세터 방법 인 값을 지정할 수있는 변수가 아닌 매개 변수를받습니다. 희망이 당신이 그것을 해결할 수있는 힌트 :) –