HOME      BLOG       FORUMS      CONTACT       ABOUT

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);
	}
}

Share

Tags: , , , ,


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.

AddThis Social Bookmark Button

Leave a Reply