Java - Skip values in for loop

后端 未结 8 2077
太阳男子
太阳男子 2021-01-07 03:06

I am trying to skip values using a for loop. Something like

for(int i = 32; i <= 255 - but skip 128 to 159; i++) {

    char ascii = (char) i;
    System.         


        
8条回答
  •  孤街浪徒
    2021-01-07 03:38

    Here is some code:

    public static void main(String[] args) {
        for(int i = 32; i <= 255; i++) {
            if (i < 128 || i > 159) {
                char ascii = (char) i;
                System.out.println(ascii);
            }
        }
    }
    

提交回复
热议问题