1. 把Strings转换成int和把int转换成String
String a = String.valueOf(2); //integer to numeric string
int i = Integer.parseInt(a); //numeric string to an int
String a = String.valueOf(2); //integer to numeric string
int i = Integer.parseInt(a); //numeric string to an int
向Java文件中添加文本
Updated: Thanks Simone for pointing to exception. I have changed the code.
BufferedWriter ut = null;
try {
out = new BufferedWriter(new FileWriter(” filename”, true));
out.write(” aString”);
} catch (IOException e) {
// error processing code
} finally {
if (out != null) {
out.close();
}
}
BufferedWriter ut = null;
try {
out = new BufferedWriter(new FileWriter(”filename”, true));
out.write(”aString”);
} catch (IOException e) {
// error processing code
} finally {
if (out != null) {
out.close();
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/122642/viewspace-1055677/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/122642/viewspace-1055677/