Convert a primitive byte value to a Byte object.
There are a couple of methods available in the Byte wrapper class that helps us to convert a primitive byte value to a Byte object.
public class BooleanWrapper {
public static void main(String[] args) {
byte b = 10;
Byte objByte = new Byte(b);
System.out.println(objByte);
}
}
or
public class BooleanWrapper {
public static void main(String[] args) {
byte b = 10;
Byte objByte = Byte.valueOf(b);
System.out.println(objByte);
}
}
Tags: Byte, Byte examples, Byte wrapper class, java.lang, java.lang.Byte
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply