저기 저부분이 자꾸 오류나는데 왜 오류인지 이유를 도저히 모르겟어요 ..;
import java.util.Scanner;
public class telecom2
{
static Scanner keyboard = new Scanner(System.in);
public static void showmenu()
{
System.out.println("선택하세요...");
System.out.println("1. 데이터 입력 ");
System.out.println("2. 프로그램 종료 ");
System.out.print("선택 : ");
}
public static void readdata()
{
System.out.print("이름 : ");
String named = keyboard.nextLine();
System.out.print("전화번호 : ");
String telecomnumber = keyboard.nextLine();
System.out.print("생년월일 : ");
String birthday = keyboard.nextLine();
phoneinfo information = new phoneinfo(named,telecomnumber,birthday);
System.out.println("\n입력된 정보 출력 ...");
information.showresult();
}
public static void main(String args[])
{
int choice;
while(true)
{
showmenu();
choice = keyboard.nextInt();
keyboard.nextLine();
switch(choice)
{
case 1:
readdata();
break;
case 2:
System.out.println("프로그램 종료 ");
return;
}
}
}
class phoneinfo
{
String name;
String telecom;
String birth;
public phoneinfo(String name,String telecom,String birth)
{
this.name = name;
this.telecom = telecom;
this.birth = birth;
}
public phoneinfo(String name,String telecom)
{
this.name = name;
this.telecom = telecom;
this.birth = null;
}
public void showresult()
{
System.out.println("name = " + name);
System.out.println("phone = " + telecom);
if(birth!=null)
{
System.out.println("생년월일 = " + birth);
}
else
{
System.out.println("이새끼는 생년월일도 없음 ");
}
}
}
}
이유좀 알려주세요 ㅠㅠ..
class phoneinfo 부분을 static class phoneinfo 로 고치시면되요
바카라2000→【주소▶affn5.w70.kr◀복사】←바카라2000◇바카라2000◇바카라2000━━바카라2000