我似乎无法找出为什么我的静态方法无法在同一个类中调用其他方法。我该怎么办?
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));
}
}
}
我在切换案例中收到错误。它给了我一个未找到的符号。任何帮助都会很棒!
答案 0 :(得分:0)
剪辑不是您的MashupII类的实例,这就是您无法调用MashupII的append()方法的原因。