编写一个程序,实现从命令行参数输入两个字符串类型的数值,并计算输出两个数值的和。
package Text6;
import java.util.Scanner;
//编写一个程序,实现从命令行参数输入两个字符串类型的数值,并计算输出两个数值的和。
public class Zuoye1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入两个整数:");
String n = sc.nextLine();
String n1 = sc.nextLine();
int s = Integer.parseInt(n);
int c = Integer.parseInt(n1);
int sum = s+c;
System.out.println(sum);
}
}
}
}