第二章
1.编写一个应用程序,给出汉字“你” “我” “他” 在Unicode表中的位置。
/*
* 要观察一个字符在Unicode表中的顺序位置,可以使用int型类型转换
*/
public class Test {
public static void main(String[] args) {
System.out.println((int)'你');
System.out.println((int)'我');
System.out.println((int)'他');
}
}
2.编写一个java应用程序,输出全部的希腊字母。
/*
* 要观察要得到0~65535之间的数所代表的Unicode表中相应位置上的字符,必须使用char型类型转换
*/
public class Test {
public static void main(String[] args) {
char cStart='α', cEnd='ω';
for(char c = cStart; c <= cEnd; c ++) {
System.out.print(c+" ");
}
}
}
第三章
1.编写应用程序求1!+ 2!+ … + 10!
public class Test {
public static void main(String[] args) {
int sum = 0;
for(int i = 1; i