This coding practice called Computer Talk wants me to cast letters as numerical value but I have no idea what its talking about | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This coding practice called Computer Talk wants me to cast letters as numerical value but I have no idea what its talking about

It starta off like this but I haven't been taught the function of char or why we're even using char.at when I only know to use it for arrays. It seems like it should be simple but it just seems complicated in this state. import java.util.Scanner; class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); char a = read.next().charAt(0); //your code goes here }

26th Feb 2021, 10:00 PM
Serana Zentha
Serana Zentha - avatar
1 Answer
+ 1
You can do casting to numerical value like System.out.println( (int)a ); This will print ASCII value of char a. But am not fully umderstood the problem. Posting full description may helps.. Hope it helps..
27th Feb 2021, 2:42 PM
Jayakrishna 🇮🇳