我在这个版本中遇到了一些问题。首先它不会加载主类。其次,我需要用户输入他们选择的音乐,然后我需要编译器来打印选择。有人可以帮我处理这段代码吗?请原谅我,但我对编程完全陌生。
public class music {
public static void music(String[] args) {
System.out.println("What's your favorite kind music?: ");
System.out.println("1. Country");
System.out.println("2. Rock");
System.out.println("3. Heavy Metal");
System.out.println("4. Folk");
try{
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
int s = Integer.parseInt(bufferRead.readLine());
switch(s){
case 1:
System.out.println("Country");
break;
case 2:
System.out.println("Rock");
break;
case 3:
System.out.println("Heavy Metal");
break;
case 4:
System.out.println("Folk");
break;
default:
System.out.println("Country");
break;
}
}catch(IOException e){
e.printStackTrace();
}