안녕하세요, 저는 Java에 익숙하지 않으며 다이빙 경쟁을 에뮬레이트 할 간단한 programm을 작성하고 있습니다. NetBeans를 사용하고 왜이 오류가 발생하는지 알 수 없습니다. 코드는 이것이다 :기호 오류를 찾을 수 없습니다. Netbeans
package agoneskataduseon;
import java.util.Scanner;
public class AgonesKataduseon {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int numAth, numJud, numDiv;
System.out.print("Give the number of the athletes in the competition : ");
numAth = input.nextInt();
System.out.print("Give the number of the judges : ");
numJud = input.nextInt();
System.out.print("Give the numbe rof dives : ");
numDiv = input.nextInt();
DivingCompetition game = new Diving Competition(numAth, numJud, numDiv);
}
}
DivingCompetition 클래스 (이 완료되지 않음) :
import java.util.Scanner;
public class DivingCompetition {
int numa;
int numj;
int numd;
Athlete[] arr1 = new Athlete[12];
Athlete[] arr2 = new Athlete[12];
public DivingCompetition(int numAthletes, int numJudges, int numDives){
numa = numAthletes;
numj = numJudges;
numd = numDives;
}
public void readAthletesName(){
String nam;
int i=0;
Scanner input = new Scanner(System.in);
while(i < numa){
System.out.print("Give the name of athlete num "+(i+1)+" : ");
nam = input.nextLine();
arr1[i] = new Athlete(nam);
i++;
}
}
public void runCompetition(){
int i=0;
Dive dv = new Dive(numj);
while(i<12){
arr1[i].addDive(dv);
}
}
}
그리고 레코드에 대한 선수 클래스 :
public class Athlete {
String names;
Dive[] arrayd = new Dive[6];
double fullScore;
int point;
public Athlete(String name){
names = name;
fullScore = 0;
point = 0;
}
public void addDive(Dive dive){
arrayd[point] = dive;
fullScore = fullScore + arrayd[point].computeScore();
point++;
}
}
것은 나 또한 당신에게 줄 것이다 다이브 클래스하지만 그 일의 요점을 참조하십시오.
NetBeans는 givi입니다. 클래스 AgonesKataduseon
을 그리고 내 질문은 나에게이 오류를 제공하는 이유 : 위치 클래스 DivingCompetition : 기호 기호를 찾을 수 없습니다 : 메인 함수 나에게 오류를 겨? 주 기능의 선수 또는 잠수의 목표를 만들려고하는 경우에도이 문제가 발생합니다.
클래스를 가져와야한다고 생각합니다. 'Ctrl-Shift-I'을 시도해보십시오. 출처 : https://netbeans.org/project_downloads/usersguide/shortcuts-80.pdf – markspace
'DivingCompetition'은 같은 패키지에 없기 때문에. –
Ctrl-Shift-I 방법을 시도했지만 가져 오기 문을 수정하는 데 아무런 내용이 없습니다. 다른 해결책을 내게 sugggest 수 있습니까? 나는 NetBeans에 익숙하지 않으며 작동 방식에 익숙하지 않다. –