Java第三章习题3-4(for循环输出俄文字母表)

来源:互联网 发布:网络推广专员 编辑:程序博客网 时间:2024/05/01 23:13

Letter.java

/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author Administrator */public class Letter {    public void print(){        char startLetter='а',endLetter='я';        int startPosition=startLetter,endPosition=endLetter;        for(int i=startPosition;i<endPosition;i++){            char russiannumber=(char)i;            System.out.print(" "+russiannumber);            if((i-startPosition+1)%10==0){                System.out.println("");            }        }            }    }


Test.java

/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author Administrator */public class Test {    public static void main(String[] args){        Letter le=new Letter();        le.print();    }    }



0 0