This Java program prompts the user to input a byte value and then converts the byte value to a string using the Byte.toString() method. The resulting string is then printed to the console.
Here's a brief explanation of the program:
Note that the Byte.toString() method is a static method that takes a byte value as its argument and returns a String representation of that value.
import java.util.Scanner; public class ByteToString { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str; byte byte_val = 0; System.out.print("Enter the Byte Value : "); byte_val = input.nextByte(); //Convert byte to string str = Byte.toString(byte_val); System.out.println("String value : " + str); } }
Enter the Byte Value : 23 String value : 23
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions