+ 2

public class Main { public static void main(String[] args) { int a = 'a'; System.out.print(a); } }

out put is 97 , how

9th Sep 2018, 7:29 AM
sapan
sapan - avatar
6 Answers
+ 1
Here comes the concept of widening Int type have 4Bytes of memory wr as char have 2Bytes of memory. So storing or converting smaller one into bigger one does not cause any data loss. So ASCII value of char is assigned to int
16th Sep 2018, 6:50 AM
vinitha chinthalapally
+ 10
output is 97 because you hava initialized character 'a' as integer type so the output is given as ASCII(American Standard Code For Information Interchange) So ASCII values of char A - Z is 65-90 and char a-z is 97-122. As you have written small a its value is 97
9th Sep 2018, 8:00 AM
Purab Gupta
Purab Gupta - avatar
+ 8
welcome
9th Sep 2018, 10:10 AM
Purab Gupta
Purab Gupta - avatar
+ 2
1. Java program to convert string into mm/dd/yyyy format
9th Sep 2018, 7:33 AM
sapan
sapan - avatar
+ 1
thanks buddy
9th Sep 2018, 8:07 AM
sapan
sapan - avatar
+ 1
thanks
16th Sep 2018, 7:47 AM
sapan
sapan - avatar