This section illustrate the conversion from char to Byte. Here, we are going to convert a char type variable into byte type variable . The following program helps you to convert from char to byte by providing the complete source code with program description.
This program also defines the charAt() method used to find the character at the specified position. First of all, define the class named "CharToByte" for java component. The program reads an input string from the command line and stores it in a string, read the character at the specified position using the charAt() method and store it in a character type variable, convert this variable into byte by typecasting and then print the value at the console.
Here is the code of this program:
Output this program.
Enter a char :
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: July 3, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles