Byte Wrapper class Programs:


  • The java.lang.Byte class is used represent byte primitive value in form of Byte Object

  1. public final class Byte
  2. 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:

  1. package com.instanceofjavatutorial;

  2. import java.lang.*; 

  3. public class ByteClass {

  4. public static void main(String[] args) {

  5.       Byte a;
  6.       a = new Byte("100");

  7.       byte t;
  8.       t = a.byteValue();

  9.       String s= "byte value of Byte object " + a + " is " + t;

  10.       System.out.println( s);

  11.    }
  12. }


Output:
  1. byte value of Byte object 100 is 100












Instance Of Java

We are here to help you learn! Feel free to leave your comments and suggestions in the comment section. If you have any doubts, use the search box on the right to find answers. Thank you! 😊
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu