Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Java-conversion Convert Decimal To Character

Related Tutorials


 
 

Share on Google+Share on Google+

Convert Decimal To Character

Advertisement
This is the simple program of java.lang package. In this example, we are going to convert decimal number to its corresponding character.

Convert Decimal To Character

     

This is the simple program of java.lang package. In this example, we are going to convert decimal number to its corresponding character.

Code Description:

Here, define class named ?DecimalToChar? for java component. This program takes a decimal value. Type casting (char) d ) is done to convert the decimal into the corresponding character..

Here is the code of this program:

import java.io.*;
import java.lang.*;

  public class DecimalToASCII{
  public static void main(String args[]) throws IOException{
  BufferedReader buff = 
  new 
BufferedReader(new InputStreamReader(System.in));
  System.out.println("Enter the Decimal number:");
  String str = buff.readLine();
  int d = Integer.parseInt(str)
  char c = (chard ;
  System.out.println("Enter decimal number is:=" + d);
  System.out.println("ASCII OF:=" + c );
  }
  }

Download of this program:

Output of this program given below.

C:\corejava>java DecimalToASCII
Enter the Decimal number:
65
Enter decimal number is:=65
ASCII OF:=A
C:\corejava>
Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 10, 2007

Related Tutorials

Discuss: Convert Decimal To Character   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
mahya
September 3, 2013
binary to text

how to convert binary code to text in java with source code.
DMCA.com