Byte Wrapper class Programs:
- The java.lang.Byte class is used represent byte primitive value in form of Byte Object
- public final class Byte
- extends Number implements Comparable<Byte>
Byte Class Constructors:
1.Byte(byte value)
2.Byte(String s)
Byte Class Methods:
- public byte byteValue() returns the value of this Byte as a byte.
Program:
- package com.instanceofjavatutorial;
- import java.lang.*;
- public class ByteClass {
- public static void main(String[] args) {
- Byte a;
- a = new Byte("100");
- byte t;
- t = a.byteValue();
- String s= "byte value of Byte object " + a + " is " + t;
- System.out.println( s);
- }
- }
Output:
- byte value of Byte object 100 is 100
No comments