Java实现输出特殊偏旁的汉字的功能
实验代码
E.java
package lab1;
public class E {
public static void main(String[] args) {
char ch = '研', zifu = 0;
int p = 22920, count = 5, position = 0;
System.out.println("输出" + count + "个石字旁的汉字:");
for (char c = ch; c <= ch + count; c++) {
position = (int) c;
System.out.printf("%c(%d)\n", c, position);
}
System.out.println();
System.out.println("输出" + count + "个女字旁的汉字:");
for (int n = p; n <= p + count; n++) {
zifu = (char) n;
System.out.printf("%c(%d)\n", zifu, n);
}
}
}