Digit as Word with Java

tasks

#1

Hello,

I just solved Digit as Word and would like to know if there is an easier way to do the comparison between String words such as “kek” and Integers such as 6 when taking user input. Here is my answer: https://hastebin.com/nafolihabo.cs

I read that JavaScript handles variable types automatically. With Java this task seems however a bit too hard because types must be known before. Would this type of a task be possible to be asked in the Exam? Seems like the task is designed for JavaScript?

Best regards,
Kristina


#2

To answer my own question, I found this way to solve this which is simpler: https://hastebin.com/cidoworasa.cs


#3

Simple switch case should work fine :wink: I’m not gonna paste code at that time. Try to find your solution and if you stuck then ping me :wink: