如何使用命令行调用,帮我举了例子,
解决方案 »
- smslib 读不到端口问题
- java.lang.VerifyError异常,求助!
- Java如何改变图片中图像的内容
- 请教
- 麻烦看看为何THROW方法不能正常运行~~
- 请教一个组合键的判断问题,如果判断ctrl+a这样的键盘事件呢?
- ---如何用正则表达式不区分大小写的匹配特定的单词-----
- 我写了一个上传下载组件,需要的可以和我联系
- 类似工作流设计Client,使用Swing如何设计,高分求救?
- 我正准备转如JAVA开发,请问我的电脑里究竟需要装多少东西(如:JBuider、UltranEdit等等)且它们都完成什么功能?---无知的人不可耻,请多帮助。
- Vector copy问题(都线程中..)
- sql语句问题 执行insert语句后 怎样返回插入数据的id
class DayCounter {
public static void main(String[] arguments) {
int yearIn = 2006 ;
int monthIn = 2 ;
if (arguments.length > 0)
monthIn = Integer.parseInt(arguments[0]);
if (arguments.length > 1)
yearIn = Integer.parseInt(arguments[1]);
System.out.println(monthIn + "/" + yearIn + " has "
+ countDays(monthIn, yearIn) + " days.");
} static int countDays(int month, int year) {
int count = -1;
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
count = 31;
break;
case 4:
case 6:
case 9:
case 11:
count = 30;
break;
case 2:
if (year % 4 == 0)
count = 29;
else
count = 28;
if ((year % 100 == 0) & (year % 400 != 0))
count = 28;
}
return count;
}
}
这是我的程序
PATH C:\j2sdk1.4.2_10\bin;
CLASSPATH ;C:\j2sdk1.4.2_10\lib\tools.jar在命令行下,进到程序所在目录,(cd 命令)
然后 javac DayCounter
最后 java DayCounter 12 2006