Java program to accept a valid blood group using regex
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ——————————————————————————————————————————— Implementation of Regular Expressions ——————————————————————————————————————————— Enter your blood group AB* Error: No such blood group ——————————————————————————————————————————— kodingwindow@kw:~$ java KW ——————————————————————————————————————————— Implementation of Regular Expressions ——————————————————————————————————————————— Enter your blood group AB- Blood group accepted ——————————————————————————————————————————— kodingwindow@kw:~$
What Next?
Java Multithreading
Advertisement