有沒有辦法將未知類型的對象轉換爲整數? 好了,我當前的代碼是:Java:返回對象的檢測類型
ImageIcon question = new ImageIcon("D:\\Project Pics\\orange QMark 1 (small).jpeg");
String[] options = { "Numbers", "Alphabets", "Both" };
JOptionPane.showInputDialog(null,"What type of array are you sorting?", "Array Type",JOptionPane.INFORMATION_MESSAGE, question, options, null);
我如何知道或發現它返回什麼類型的對象?我得到一個ClassCastException當我這樣做:
int code = (int) JOptionPane.showInputDialog(null,"What type of array are you sorting?", "Array Type",JOptionPane.INFORMATION_MESSAGE, question, options, null);
非常感謝!!!!!我現在得到它!!!!! – 2014-10-31 05:30:50