if((age<=0) && (!g.matches("^[mMfF]$"))){
System.out.println("Age and gender both are incorrect");
System.out.println("need to enter all details again");
continue;
}else if(age<=0){
System.out.println("age is less than or equal to 0");
System.out.println("need to enter all details again");
continue;
} else if(!g.matches("^[mMfF]$")){
System.out.println("Gender must be male or female other characters found");
System.out.println("need to enter all details again");
continue;
}