이있는 부분을 내가에 문제가 데 생각 : 무슨 일이 일어나고 있는지음악 재생 스크립트 (12) 오류
AudioPlayer.java:3: error: ')' expected AudioPlayer AP = new AudioPlayer(optional Replay = true); ^AudioPlayer.java:3: error: illegal start of type AudioPlayer AP = new AudioPlayer(optional Replay = true); ^AudioPlayer.java:3: error: expected AudioPlayer AP = new AudioPlayer(optional Replay = true); ^AudioPlayer.java:3: error: ';' expected AudioPlayer AP = new AudioPlayer(optional Replay = true); ^AudioPlayer.java:4: error: expected AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:4: error: expected AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:4: error: ';' expected AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:4: error: illegal start of type AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:4: error: expected AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:4: error: ';' expected AP.playSong(signlink.findcachedir() + "Music/2.wav"); ^AudioPlayer.java:6: error: expected AP.Stop(); ^AudioPlayer.java:6: error: reached end of file while parsing AP.Stop(); ^12 errors Press any key to continue . . .`
어떤 아이디어 : 여기에 내가 가진 오류입니다
public class AudioPlayer {
//play the music
AudioPlayer AP = new AudioPlayer([Optional Replay = true]);
AP.playSong(signlink.findcachedir() + "Music/2.wav");
//stop the music
AP.Stop();
}
를? 무엇이 오류를 일으키는 지, 어떻게 해결할 수 있습니까? 이와 함께이 라인
AudioPlayer AP = new AudioPlayer([Optional Replay = true]);
를 교체
AudioPlayer 클래스 생성자는 어떤 종류의 매개 변수를 가져 옵니까? –
당신이 가지고있는 것은 유효한 구문이 아닙니다. 자바에서는 그렇게 할 수 없습니다. 대신에 생성자에 부울을 허용하려고합니까? – Makoto
클래스, 인터페이스 또는 enum – jake