美文网首页
java lang包下byte类

java lang包下byte类

作者: LinkedIn | 来源:发表于2017-04-13 17:03 被阅读0次

类构造方法
S.N. 构造函数和说明
1 Byte(byte value)
结构构造一个新分配的字节对象,表示指定的字节值。
2 Byte(String s)
构造一个新分配的字节,表示该字节的值的字符串参数表示的对象

都实现number
···
package core.java.lang;

/**

  • @author DGW

  • @date 2017 2017年4月13日 下午4:39:46

  • @filename ByteClass.java
    */
    public class ByteClass {
    public static void main(String[] args) {
    Byte b=new Byte((byte)0);
    //最为byte int 值进行返回值类型
    System.out.println(b.byteValue());
    System.out.println(b.intValue());

    }

    private static void M1() {
    //静态方法说明 基本的方法相同
    System.out.println(Byte.BYTES);
    System.out.println(Byte.SIZE);
    System.out.println(Byte.MAX_VALUE);
    System.out.println(Byte.MIN_VALUE);
    System.out.println(Byte.compare((byte) (1), (byte)1));
    System.out.println(Byte.hashCode(new Byte("1")));
    //无符号
    System.out.println(Byte.toUnsignedInt((byte)0));
    //去byte值 返回一个byte对象
    System.out.println(Byte.valueOf("2"));
    }

}

···

相关文章

网友评论

      本文标题:java lang包下byte类

      本文链接:https://www.haomeiwen.com/subject/azgbattx.html