import javax.swing.JOptionPane;
public class filmboxoffice {
public static void main (String[] args)
{
String [] filmname = new String [4];
String [] filmtime = new String [4];
String name;
String time;
int result;
for(int i=1; i<5; i++)
{
name = JOptionPane.showInputDialog("What is the film on Screen "+i+" today?");
result = i;
time = JOptionPane.showInputDialog("What time does it start?");
}
JOptionPane.showMessageDialog(null,"Screen "+ result +": "+" "+filmtime [time]);
}
}
错误堆栈:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from String to int
at filmboxoffice.main(filmboxoffice.java:22)