2016-11-27 17 views
0

こんにちは、私はJavaの初心者です。私はダイビングの競争をエミュレートする簡単なプログラマーです。私は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ですクラスDivingCompetition 場所: シンボル シンボルが見つかりません:クラスAgonesKataduseon

をそして、それは私にこのエラーが発生しますなぜ私の質問はありますか?私のメイン機能でエラーをngの この問題は、メイン関数内でAthleteまたはDiveのオブジェクトを作成しようとした場合にも発生します。

+0

私はあなたがクラスをインポートする必要があると思います。 'Ctrl-Shift-I'を試してみてください。出典:https://netbeans.org/project_downloads/usersguide/shortcuts-80.pdf – markspace

+0

「DivingCompetition」は同じパッケージに含まれていないためです。 –

+0

私はCtrl-Shift-Iメソッドを試しましたが、importステートメントでは何も修正するつもりはありません。あなたは私に別の解決策を提案できますか?私はNetBeansを初めて使用しており、どのように動作するかについては使用されていません。 –

答えて

0

Netbeansは、尋ねられた場合に助けて、あなたのコードを修正するための提案をします。 Alt + を入力するだけで問題のある行にカーソルを置くだけです。

Fix Code

あなたは間違った声明にカーソルを合わせるとそれは実際にあなたのエラーメッセージの下部にあるこのキーボードショートカットを提供します。

詳細については、マニュアルのCode Assistanceページを参照してください。