「java」Integerクラスのサンプル

書式
Integer.valueOf(数値)
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
package com.arkgame.serializ.demo;
public class Sample {
private static final int num = 120;
public static void main(String[] args) {
Integer valA = num;
System.out.println("値1:" + valA);
Integer valB = Integer.valueOf(num);
System.out.println("値2:" + valB);
}
}
package com.arkgame.serializ.demo; public class Sample { private static final int num = 120; public static void main(String[] args) { Integer valA = num; System.out.println("値1:" + valA); Integer valB = Integer.valueOf(num); System.out.println("値2:" + valB); } }
package com.arkgame.serializ.demo;

public class Sample {

      private static final int num = 120;

      public static void main(String[] args) {
            Integer valA = num;
            System.out.println("値1:" + valA);
            Integer valB = Integer.valueOf(num);
            System.out.println("値2:" + valB);

      }

}

結果
値1:120
値2:120

Java

Posted by arkgame