title: Termination of program using if else statement?
body: <p>trying to terminate program using negative numbers and  if else statement . does anyone see whats wrong with this thanks.  </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Assignment {
      public static void main(String args[]){
      int n;
      int i=0;
  
      System.out.print("Enter a Number:");
      Scanner scanner = new Scanner(System.in);
      n= scanner.nextInt();
      int backUp = n;
      if(n&gt;0)
  
          n=n/10;
          i++;
  
          else if(backUp = -1)
  
          System.out.print("program terminated......");
              System.exit(0);
  
  
  
      System.out.println("Number of Digits in " +backUp +" is " +i);
  
      }
  }
  </code></pre>