Question: Please this code doesn't work please could some one tell me why it a illegal start expression and how to fix it? on line 52?

Please this code doesn't work please could some one tell me why it a illegal start expression and how to fix it? on line 52?

//PhpohoneKeypadMapping.java

import java.util.Scanner; public class PhoneKeyPads { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // Read the string from console System.out.println("Enter a phone number as a string"); String inputPhone = scanner.nextLine(); String phoneNumber = ""; int phoneDigit = 0; for (int i = 0; ipublic static int getNumber(char ch) // it say illegal start of expression { // create digit to letter mapping string per //phone keypads final String digit2Chars="ABC"; final String digit3Chars="DEF"; final String digit4Chars="GHI"; final String digit5Chars="JKL"; final String digit6Chars="MNO"; final String digit7Chars="PQRS"; final String digit8Chars="TUV"; final String digit9Chars="WXYZ"; // check the char mapping if (digit2Chars.indexOf(ch)>=0) { return 2; } if (digit3Chars.indexOf(ch)>=0) { return 3; } if (digit4Chars.indexOf(ch)>=0) { return 4; } if (digit5Chars.indexOf(ch)>=0) { return 5; } if (digit6Chars.indexOf(ch)>=0) { return 6; } if (digit7Chars.indexOf(ch)>=0) { return 7; } if (digit8Chars.indexOf(ch)>=0) { return 8; } if (digit9Chars.indexOf(ch)>=0) { return 9; } return 0; }//end of method }//end of class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!