📜  Java.lang.Byte类

📅  最后修改于: 2020-11-15 02:55:17             🧑  作者: Mango


介绍

java.lang.Byte类将原始类型byte的值包装在对象中。字节类型的对象包含一个类型为字节的字段。

类声明

以下是java.lang.Byte类的声明-

public final class Byte
   extends Number
      implements Comparable

领域

以下是java.lang.Byte类的字段-

  • 静态字节MAX_VALUE-此常量保持一个字节可以具有的最大值2 7 -1。

  • 静态字节MIN_VALUE-此常量保持一个字节可以具有的最小值-2 7

  • static int SIZE-这是用来表示二进制补码二进制形式的字节值的位数。

  • 静态Class TYPE-这是表示原始类型字节的Class实例。

类的构造函数

Sr.No. Constructor & Description
1

Byte(byte value)

This constructs a newly allocated Byte object that represents the specified byte value.

2

Byte(String s)

This constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

类方法

Sr.No. Method & Description
1 byte byteValue()

This method returns the value of this Byte as a byte.

2 int compareTo(Byte anotherByte)

This method compares two Byte objects numerically.

3 static Byte decode(String nm)

This method decodes a String into a Byte.

4 double doubleValue()

This method returns the value of this Byte as a double.

5 boolean equals(Object obj)

This method compares this object to the specified object.

6 float floatValue()

This method returns the value of this Byte as a float.

7 int hashCode()

This method returns a hash code for this Byte.

8 int intValue()

This method returns the value of this Byte as an int.

9 long longValue()

This method returns the value of this Byte as a long.

10 static byte parseByte(String s)

This method parses the string argument as a signed decimal byte.

11 static byte parseByte(String s, int radix)

This method parses the string argument as a signed byte in the radix specified by the second argument.

12 short shortValue()

This method returns the value of this Byte as a short.

13 String toString()

This method returns a String object representing this Byte’s value.

14 static String toString(byte b)

This method returns a new String object representing the specified byte.

15 static Byte valueOf(byte b)

This method returns a Byte instance representing the specified byte value.

16 static Byte valueOf(String s)

This method returns a Byte object holding the value given by the specified String.

17 static Byte valueOf(String s, int radix)

This method returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument.

方法继承

此类从以下类继承方法-

  • java.lang.Object