メソッドの呼び出しをするときに、引数に何を入れたらよいかが分かりません。よろしくお願いします。
コンパイルエラーは以下のようになっています。
javac MapGame.java
MapGame.java:33: エラー: クラス MapGameのメソッド timerは指定された型に適用できません。
timer();
^
期待値: String[]
検出値: 引数がありません
理由: 実引数リストと仮引数リストの長さが異なります
エラー1個
コードは以下です。
Java
1import javafx.application.Application; 2import javafx.scene.Scene; 3import javafx.scene.control.Button; 4import javafx.scene.control.Label; 5import javafx.scene.control.TextField; 6import javafx.scene.layout.BorderPane; 7import javafx.scene.layout.Pane; 8import javafx.stage.Stage; 9import javafx.fxml.FXMLLoader; 10 11import java.text.ParseException; 12import java.text.SimpleDateFormat; 13import java.util.Timer; 14import java.util.TimerTask; 15 16 17 18public class MapGame extends Application { 19 Stage stage; 20 21 @Override 22 public void start(Stage primaryStage) throws Exception { 23 stage = primaryStage; 24 primaryStage.setTitle("MAP GAME"); 25 Pane myPane_top = (Pane)FXMLLoader.load(getClass().getResource("MapGame.fxml")); 26 Scene myScene = new Scene(myPane_top); 27 primaryStage.setScene(myScene); 28 primaryStage.show(); 29 } 30 31 public static void main(String[] args) { 32 launch(args); 33 timer(); 34 } 35 36 public static void timer(String[] args) throws ParseException { 37 SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); 38 Timer timer = new Timer(false); 39 TimerTask task = new TimerTask() { 40 41 @Override 42 public void run() { 43 System.out.println("てすと"); 44 timer.cancel(); 45 } 46 }; 47 timer.schedule(task, 60000); 48 } 49} 50
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。