大学JAVA考试的一道简单的题目 求答案

Write a Java program(name it IO.java) to do the following tasks:
1) Prompts the user to input two integers.
2) Create a text file named "sum.txt" at the current dictionary.
3) Compute and write the sum of the two integers in the "sum.txt" file.
What is the output of the following program?程序的输出是什么
public class Test {
public static void main(String[] args) {
int a = 11; int b = 8;
int temp = b; b = a; a = temp;
System.out.println( a );
System.out.println( b );
}
}
最后一题了 求答案 a=? b=?

public class IO {

public static void main(String[] args) throws Exception {
Scanner scn = new Scanner(System.in);
System.out.println("please input to integers: ");
int result = scn.nextInt() + scn.nextInt();
new FileOutputStream("sum.txt").write(String.valueOf(result).getBytes());

}

}

追问

请问能用eclipse调试过成功了吗 我考试用eclipse这个软件的

追答

肯定能啊,放心吧

追问

能留下个QQ吗 谢谢啦

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-03-15
io流