2016-11-27 3 views
0

안녕하세요, 저는 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 : 기호 기호를 찾을 수 없습니다 : 메인 함수 나에게 오류를 겨? 주 기능의 선수 또는 잠수의 목표를 만들려고하는 경우에도이 문제가 발생합니다.

+0

클래스를 가져와야한다고 생각합니다. 'Ctrl-Shift-I'을 시도해보십시오. 출처 : https://netbeans.org/project_downloads/usersguide/shortcuts-80.pdf – markspace

+0

'DivingCompetition'은 같은 패키지에 없기 때문에. –

+0

Ctrl-Shift-I 방법을 시도했지만 가져 오기 문을 수정하는 데 아무런 내용이 없습니다. 다른 해결책을 내게 sugggest 수 있습니까? 나는 NetBeans에 익숙하지 않으며 작동 방식에 익숙하지 않다. –

답변

0

Netbeans는 도움을 요청하고 제안한 경우 코드를 수정하도록 제안합니다. 문제가있는 행에 커서를 놓고 Alt + 을 입력하십시오.을 입력하십시오. 당신이 잘못된 문 위에 마우스를 올려 때

Fix Code

은 실제로 당신이 오류 메시지의 맨 아래에있는이 키보드 바로 가기를 제공합니다.

자세한 내용은 설명서의 Code Assistance 페이지를 참조하십시오.

관련 문제