Tutorialspoint examples

Learn java tutorial with examples for beginners online

Convert ascii to string java program


Java convert ascii to string java example

package com.tutorialspointexamples;
 
public class ASCIIToString {
  public static void main(String args[]){
	try {
             int num[] = {66, 118, 98, 75};
             String str =null;
             for(int i: num){
               str = Character.toString((char)i);
               System.out.println(str);
             }
	} catch (Exception e) {
		e.printStackTrace();
	}
  }
}

Output:

B
v
b
K

Download this example.

Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status