program crashes when you type letters instead of numbers, how can protect this program?

public static void main(String args[]) { /* problem*/
        Scanner scan=new Scanner (System.in);       
        int a; // problem//
        System.out.println("a nedir");
        a=scan.nextInt();
}

As i can understand, when the input is not integer, the program stops. So here is simple solution : use the method nextLine() instead of nextInt(). Check if the input is not number catch the exception and continue unless you get a number.

        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        int number = 0;

        while (true) {
            try {
                number = Integer.parseInt(input);
                return;
            } catch (Exception e) {
                System.out.println("Invalid number");
            }
            input = scanner.nextLine();
        }

Scanner.nextInt() throws an exception if no integer is found. You either need to catch the exception and handle it, or prevent it from occurring by using Scanner.hasNextInt()

For example:

public static void main(String args[]) {
    Scanner scan = new Scanner(System.in);       
    int a;
    System.out.println("a nedir");
    if(scan.hasNextInt()){
         a = scan.nextInt();
    }
    else{
        //Add code to handle invalid input here
        //ie. propmt the user to renter input or something like that
    }
}

If you leave the else block blank it will still work but nothing will happen when you enter in a non-numerical input.