How to Read and Condition a Java String

Asked

Viewed 35 times

0

I need to know the following: I want to make a program that Le a number and then write the name of the number: For example: was typed the number 29340, then appears: 2-Two, 9-Nine, 3-Three, 4-Four, 0-Zero. I’m trying to make turning to String catching length and with string.equals, but I’m not getting it! For it seems that he reads the previous numbers together with the following... If anyone can help me I thank you

  • Misael, click [Edit] and post the code you already tried and how is the output.

  • String value = "a", be="b"; Scanner s = new Scanner(System.in); String Letter=s. next(); String tmpValor = String.valueOf(Letter); String newValor = ""; for (int i = 0; i < tmpValor.length(); i++) { newValor = newValor + tmpValor.substring(i, i+1) + " "; if (tmpValor == value) { System.out.println("Letter A"); } Else if (tmpValor == be) { System.out.println("Letter B");

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.