Java Program to Convert Byte Into the String

You are currently viewing Java Program to Convert Byte Into the String

Java program to convert byte into the string

// Java program to convert byte 
// into the string

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner X = new Scanner(System.in);
    String str;
    byte bytVal = 0;

    System.out.print("Enter byte value: ");
    bytVal = X.nextByte();

    //Convert byte value into string.
    str = Byte.toString(bytVal);

    System.out.println("String value: " + str);
  }
}

Output

Enter byte value: 124
String value: 124

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply