java 小程序 麻烦看一下有什么问题
importjavax.swing.JOptionPane;publicclassDisplayTime{publicstaticvoidmain(String[]arg...
import javax.swing.JOptionPane;
public class DisplayTime{
public static void main(String[] args){
int seconds=500;
int minutes=seconds/60;
int remainingSeconds=seconds%60;
JOptionPane.showMessageDialog(null,seconds+" second is "+minutes+" minutes and "+remainingSeconds +" seconds");
JOptionPane.showMessageDialog(null,"u6B22\u8FCE \u03b1 \u03b2 \u03b3","u6B22\u8FCE welcome",JOptionPane.INFORMATION_MESSAGE);
System.out.println("The temperature is "+args[0]+ "aa" +args[1]);
}
} 展开
public class DisplayTime{
public static void main(String[] args){
int seconds=500;
int minutes=seconds/60;
int remainingSeconds=seconds%60;
JOptionPane.showMessageDialog(null,seconds+" second is "+minutes+" minutes and "+remainingSeconds +" seconds");
JOptionPane.showMessageDialog(null,"u6B22\u8FCE \u03b1 \u03b2 \u03b3","u6B22\u8FCE welcome",JOptionPane.INFORMATION_MESSAGE);
System.out.println("The temperature is "+args[0]+ "aa" +args[1]);
}
} 展开
4个回答
展开全部
import javax.swing.JOptionPane;
class MyFirstClass{
public static void main(String[] args){
int seconds=500;
int minutes=seconds/60;
int remainingSeconds=seconds%60;
JOptionPane.showMessageDialog(null,seconds+" second is "+minutes+" minutes and "+remainingSeconds +" seconds");
JOptionPane.showMessageDialog(null,"u6B22\u8FCE \u03b1 \u03b2 \u03b3","u6B22\u8FCE welcome",JOptionPane.INFORMATION_MESSAGE);
System.out.println("The temperature is "+args[0]+ "aa" +args[1]);
}
}
异常为:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at MyFirstClass.main(MyFirstClass.java:12)
class MyFirstClass{
public static void main(String[] args){
int seconds=500;
int minutes=seconds/60;
int remainingSeconds=seconds%60;
JOptionPane.showMessageDialog(null,seconds+" second is "+minutes+" minutes and "+remainingSeconds +" seconds");
JOptionPane.showMessageDialog(null,"u6B22\u8FCE \u03b1 \u03b2 \u03b3","u6B22\u8FCE welcome",JOptionPane.INFORMATION_MESSAGE);
System.out.println("The temperature is "+args[0]+ "aa" +args[1]);
}
}
异常为:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at MyFirstClass.main(MyFirstClass.java:12)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
System.out.println("The temperature is "+args[0]+ "aa" +args[1]);
这一句去掉,这一句没实际意义,在你运行的时候不传入两个以上的参数就会抛数组越界的异常。
这一句去掉,这一句没实际意义,在你运行的时候不传入两个以上的参数就会抛数组越界的异常。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
挺好的,没什么问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询