Could anyone please help me solve this code I keep getting e

Could anyone please help me solve this code, I keep getting error. My main concern how to print these line out \"Print out the length of the name if it is more than 10 and less than 20 characters long, and the third letter in the name\"

Solution

NameLength.java

import java.util.Scanner;

public class NameLength {

   public static void main(String[] args) {
System.out.println(\"___________Class Activity___________\");

Scanner scn = new Scanner(System.in);
System.out.print(\"Please enter your name :\");
String name = scn.nextLine();
processName(name);
}

/**
* Print out the length of the name if it is more than 10 and less than 20 characters long, and the third letter in the name
*/
private static void processName(String name) {
  
int len = name.length();
if (len > 10 && len < 20) {
System.out.println(\"Wow,\" + name + \" that name is between 10 and 20 characters long!\");
char thirdLetter = name.charAt(2);
System.out.println(\"Your name has \" + len + \" letters and the third letter is \'\" + thirdLetter+\"\'\");
}
else
   System.out.println(name + \" that name is not between 10 and 20 characters long!\");
  
}

}

__________________

Output#1:

___________Class Activity___________
Please enter your name :Kane Williams
Wow,Kane Williams that name is between 10 and 20 characters long!
Your name has 13 letters and the third letter is \'n\'

_________________

Output#2:

___________Class Activity___________
Please enter your name :Robert
Robert that name is not between 10 and 20 characters long!

___________Thank You

Could anyone please help me solve this code, I keep getting error. My main concern how to print these line out \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site