import java.util.Scanner; public class VerifyBoolean { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a string value: "); String str = sc.next(); if(str.equalsIgnoreCase("true")||str.equalsIgnoreCase("false")){ System.out.println("Given string is a boolean type"); }else { System.out.println("Given string is not a boolean type"); } } }