Skip to main content
Update code formatting
Source Link

You can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input.

import java.util.Scanner; public class Test {  public static void letters()  {   System.out.println("Enter input char");   Scanner sc = new Scanner(System.in);   String input = sc.next();   System.out.println("Output : ");   for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) {   if (input.toUpperCase().indexOf(alphabet) < 0)   System.out.print(alphabet + " "); } } public static void main(String[] args) { letters(); } } 

Ouput Example

Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 

You can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input.

import java.util.Scanner; public class Test { public static void letters() { System.out.println("Enter input char"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("Output : "); for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) { if(input.toUpperCase().indexOf(alphabet) < 0) System.out.print(alphabet + " "); } } public static void main(String[] args) { letters(); } } 

Ouput Example

Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 

You can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input.

import java.util.Scanner; public class Test {  public static void letters()  {   System.out.println("Enter input char");   Scanner sc = new Scanner(System.in);   String input = sc.next();   System.out.println("Output : ");   for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) {   if (input.toUpperCase().indexOf(alphabet) < 0)   System.out.print(alphabet + " "); } } public static void main(String[] args) { letters(); } } 

Ouput Example

Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 

You can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input.

you can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input. import java.util.Scanner;   public class Test {   public static void letters() { System.out.println("Enter input char"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("Output : "); for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) {   if(input.toUpperCase().indexOf(alphabet) < 0)   System.out.print(alphabet + " ");   }  }  public static void main(String[] args) {   letters(); } } 

}Ouput Example

//Ouput Example Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 
you can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input. import java.util.Scanner;   public class Test {   public static void letters() { System.out.println("Enter input char"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("Output : "); for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) {   if(input.toUpperCase().indexOf(alphabet) < 0)   System.out.print(alphabet + " "); } } public static void main(String[] args) { letters(); } 

}

//Ouput Example Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 

You can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input.

import java.util.Scanner; public class Test { public static void letters() { System.out.println("Enter input char"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("Output : "); for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) { if(input.toUpperCase().indexOf(alphabet) < 0) System.out.print(alphabet + " ");   }  }  public static void main(String[] args) {   letters(); } } 

Ouput Example

Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z 
Source Link
Nandu cg
  • 84
  • 1
  • 10

you can use this code. It will check the char is present or not. If it is present then the return value is >= 0 otherwise it's -1. Here I am printing alphabets that is not present in the input. import java.util.Scanner; public class Test { public static void letters() { System.out.println("Enter input char"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("Output : "); for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) { if(input.toUpperCase().indexOf(alphabet) < 0) System.out.print(alphabet + " "); } } public static void main(String[] args) { letters(); } 

}

//Ouput Example Enter input char nandu Output : B C E F G H I J K L M O P Q R S T V W X Y Z