Code to find the number of characters in the string. Unable to get a desired output. Unclear about what i am missing. Kindly suggest : Below code outputs only "Enter a string" and accepts user input however, does not display the number of characters in the string. Kindly help!
    
    System.out.println("Enter a string");
    		Scanner scan = new Scanner (System.in);
    		String a = scan.nextLine();
    		
    		
    		try{
    			
    			while(a != null){
    			count++;
    		}
    			
    		} 
    		catch(Exception e) 
    		{ 
    			System.out.println("Invalid string");
    		}
    		
    		System.out.println("The number of characters are : " + count);