-5
我似乎無法找出爲什麼我的靜態方法無法調用同一類中的其他方法。我該怎麼辦?JAVA:爲什麼我不能訪問同一個類中的方法?
import java.util.Scanner;
import java.util.*;
public class MashupII {
public void Append(Sound clip, boolean rev, double scale){
//Void methods...
//main method
public static void main (String [] args) {
Scanner keyboard = new Scanner(System.in);
clips = new Sound[100];
System.out.println("Please enter your command (A, I, D, P or Q)");
char command = Character.toUpperCase(keyboard.next().charAt(0));
while (command != 'Q'){
switch (command){
case 'A':
//APPENDING
//pick the clip
System.out.println("Please pick a file.");
Sound clip = new Sound(FileChooser.pickAFile());
//reversing
System.out.println("Would you like to reverse the clip? (Y|N)");
String reverse = keyboard.nextLine();
boolean rev = reverse.equalsIgnoreCase("Y");
//scaling
System.out.println("How much should the clip be scaled? (1 is no scaling)");
double scale = keyboard.nextDouble();
clips.Append(clip,rev,scale);
break;
case 'I':
break;
case 'D':
System.out.println("Which clip would you like to delete? (1- end)");
int p = keyboard.nextInt();
clips.Delete(p);
break;
case 'P':
break;
default:
System.out.println("Error! Please enter one of the available commands (A, I, D, P or Q)");
}
System.out.println("Please enter another command (A, I, D, P or Q)");
command = Character.toUpperCase(keyboard.next().charAt(0));
}
}
}
我得到了開關情況下的錯誤。它給了我一個沒有找到的符號。任何幫助將是偉大的!
找不到哪個符號? – NeplatnyUdaj
'clips.Append(clip,rev,scale);'...剪輯是你的聲音陣列。 – pL4Gu33
我沒有看到你使用'MashupII'中聲明的任何方法。 –