2
0

More than 3 years have passed since last update.

97~127までの数値をキャストで文字にする

Posted at

97~127までの数値(int型)をキャストで文字(char型)にするプログラムです。
この機能は初めて知りました。

// 新規作成  2021/6/25
// Aunthor  乃木坂好きのITエンジニア

public class CharTest {
    public static void main(String[] args) {
//配列を定義する
        int[]  moji = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127};
//拡張ループ文で数値(int型)を文字(char型)に変換してループ文を回す
        for(int i:moji) {
            System.out.println((char)i);
        }

    }
}
2
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0