I was wanting to make my program,in Java, In which it decides,based upon user input, if the input is a valid character. The valid characters consist of : numbers, and decimals. I must verify and make sure that these characters are not valid: + - .(must appear once only) Code so Far:
import java.util.Scanner;
public class Program4 {
public static void main(String[] args) {
//Makes Variables
    String z;
    int max;
// Scanner
Scanner Input =  new Scanner(System.in);
// Asks user to input the number    
System.out.println("Please enter a valid (4 character) double literal :");
//Accepts users input   
z= Input.nextLine();
  max = Integer.parseInt(z);
//Based on User input outputs
  if (max >= 0.0 & max <= 9.0) 
  {
      System.out.print(max+" is a valid (4 character) double literal");
      if (max>9.0){
          System.out.print(max+" is a valid (4 character) double literal");
          if(max<9.0)
          {
              System.out.print(max+" is a valid (4 character) double   literal");   
          }
      }
  }
//closes scanner
   Input.close();   
 }
}
 
     
     
    