- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to assign int value to char variable in Java
To assign int value to a char variable in Java would consider the ASCII value and display the associated character/ digit.
Here, we have a char.
char val;
Now assign int value to it.
val = 77;
Now, when you will print the value of “val”, it would display the character associate with the value (ASCII) 77.
The following is the complete example.
Example
public class Demo { public static void main(String []args) { char val; val = 77; System.out.print("Value: "); System.out.println(val); } }
Output
Value: M
- Related Articles
- How do I assign a dictionary value to a variable in Python?
- How to assign a PHP variable to JavaScript?
- How to assign a reference to a variable in C#
- Assign other value to a variable from two possible values in C++
- How to convert a single char into an int in C++
- Store unicode in a char variable in Java
- How can we assign a bit value as a number to a user variable?
- How to assign multiple values to a same variable in Python?
- How to assign multiple values to same variable in C#?\n
- Swift Program to Convert Char type variables to Int
- Haskell Program to convert int type variables to char
- Concatenate string to an int value in Java
- How can we assign a function to a variable in JavaScript?
- How do I convert a char to an int in C and C++?
- Java Program to convert an int value to String

Advertisements