Hello, I tried to get the program to tell me when I entered more or less than 11 digits, but even if I made sure to enter exactly 11, it still said " number must be 11 digits long. " What am I doing wrong?
import java.util.Scanner; public class temp { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("enter a number"); String number = scanner.nextLine(); int numberlength = number.length(); while (numberlength != 11) { System.out.println("the number must be 11 digits long"); number = scanner.nextLine(); } System.out.println("done."); } }