我正在嘗試將數組傳遞給方法。我在編譯時不斷收到錯誤,錯誤是「找不到符號songArray」。將數組傳遞給方法,遇到錯誤是「找不到符號songArray」
SongTestDrive
import javax.swing.JOptionPane;
public class SongTestDrive {
public static void main(String[] args) {
String[] Song = { "Song title: soul to squeeze", "Artist: Red Hot Chili Peppers", "Genre: Funk Rock", "Year: 1993", "Song title: Slaughtered",
"Artist: PanterA", "Genre: Groove Metal", "Year: 1994" };
songArray(); //<--- Im having issues right here//
}
}
宋
import javax.swing.JOptionPane;
public class Song {
String name;
String artist;
String genre;
int year;
public void songArray(String[] Song) {
for (String o : Song) {
JOptionPane.showMessageDialog(null, o);
}
}
}
任何幫助將是有益的。
songArray(宋); – athabaska