Java Byte - toString() Method
The java.lang.Byte.toString() method returns a new String object representing the specified byte. The radix is assumed to be 10.
Syntax
public static String toString(byte b)
Parameters
b |
Specify the byte to be converted. |
Return Value
Returns the string representation of the specified byte.
Exception
NA.
Example:
In the example below, the java.lang.Byte.toString() method returns a String object representing the given byte.
import java.lang.*; public class MyClass { public static void main(String[] args) { //creating a byte value byte x = 25; //printing the byte value System.out.println("The byte value is: " + x); //creating and printing the string //representation of the byte value String x_tostring = Byte.toString(x); System.out.println("The string value of byte is: " + x_tostring); } }
The output of the above code will be:
The byte value is: 25 The string value of byte is: 25
❮ Java.lang - Byte