import javax.swing.JPanel;
Java 클래스에서 그룹 프로젝트로 만드는 기본 "모험"게임에 대한 플레이어 클래스를 만들어야합니다. 이클립스는 내 get 및 set 메소드 (getStr, getAgi 등)가 모두 블록을 완료하기 위해 세미콜론을 필요로한다고 알려줍니다. 그러나 나는 그것이 옳지 않다는 것을 안다. 일반적으로 도움이나 조언이 필요하십니까?내 Java 프로젝트와 관련된 문제
public class playerChars extends JPanel{
private int str, agi, intell, hitP;
private String wep, arm;
die sixSidedDie = new die(6);
{
public int getStr(str)
{
str = sixSidedDie.getValue();
}
public int getAgi(agi)
{
agi = sixSidedDie.getValue();
}
public int roll(intell)
{
intell = sixSidedDie.getValue();
}
public int getHitP(hitP)
{
hitP = sixSidedDie.getValue();
}
}
public static int setQuant(int quantity)
{
int quant;
quant = quantity;
}
public String getWep()
{
return wep;
}
public String setWep(String weapon)
{
this.wep = weapon;
}
public String getArm()
{
String armor;
return armor;
}
public String setArm(String armor)
{
this.arm = armor;
}
public int setPot(int potion)
{
int pot;
pot = potion;
}
public int getPot()
{
int potion;
return potion;
}
}
먼저 기본 자바를 배워야합니다. 이것은 올바른 형식화조차되지 않습니다. –
올바른 형식 지정에 대한 제안 사항을 알려주시겠습니까? – rythmshifter
이것은 기본적인 Java 기본 사항에 대한 문제입니다. 분명히 Java를 전혀 모르는 상태에서 천천히 가져 가십시오. –