title: Incompatible return type error java
body: <pre><code>class BankAccount {
      private String firstname;
      private String lastname;
      private int ssn;
      private int accountnumber = 0;
      private double accountbalance = 0.0;
  
      BankAccount() {
          firstname = "John Smith";
      }
  
      BankAccount(String firstname, String lastname, int ssn) {
          int accountnumber;
          double accountbalance;
      }
  
      public String getName() {
          return firstname;
      }
  
      public double getBalance() {
          return accountbalance;
      }
  
      public void setAccountNumber(int accountnumber) {
          return accountnumber;
      }
  
      public boolean equals(BankAccount ba) {
          return this.accountbalance == ba.accountbalance;
      }
  
      public void deposit(double amount) {
          return this.accountbalance = this.accountbalance + amount;
      }
  
      public int withdraw(double amount) {
          this.accountbalance = this.accountbalance - amount;
          if(accountbalance &lt; 0) {
              this.accountbalance = this.accountbalance + amount;
              return -1;
          }
          else
             return 0;
      }
  
      public String toString() {
          return firstname+lastname+"/n"+"social secuirty "+"ssn"+"/n"+"account number is "+
          "accountnumber" +"/n" +"Balance:" +"accountbalance" +"/n";
      }
  }
  </code></pre>
  
  <p>Error is : </p>
  
  <pre><code>BankAccount.java:34: error: incompatible types: unexpected return value
  return accountnumber;
         ^
  BankAccount.java:47: error: incompatible types: unexpected return value
  return this.accountbalance=this.accountbalance+amount;
                            ^
  2 errors
  </code></pre>
  
  <p>What am I doint wrong?</p>