Q:

Net beans if-else statements

Can somebody help me get my code to work correctly. It's supposed to accept a string that is the date from the user in the format mm/dd/yyyy. I got it to work with the general format using the lines :
for(int i=0; i<strlen; i++) {        // strlen is string length
   if(i==2 || i==5) {
      if (date.charAt(i) !='/') {       // date is the input by the user
         isdate = false;
         System.out.println("Wrong format! (Use mm/dd/yyyy)");  
         break;

      }
   }
   else {
      char tpchar=date.charAt (i);
      isdate = tpchar>='0'&&tpchar<='9';

That part works well, my problem is getting the 'mm' digits to be 1-12. I used this :
  if (date.charAt(0) != '0' || date.charAt(0) != '1') {
       isdate = false;
       System.out.println("wrong format");

  } 
  if (date.charAt(1) >= '0' && date.charAt(1) <= '9'){

  }
  else {
       isdate = true;

but this pretty much does nothing. It just prints the "wrong format" line. 
If this isn't enough info for you to help you can email me for the rest of the program (its < 50 lines). My email is majlil93@gmail.com just email me with a "date program" subject.

A:

Your if condition should be an and:
if (date.charAt(0) != '0' && date.charAt(0) != '1') 

