Skip to content

Instantly share code, notes, and snippets.

@hirayGui
Forked from danielmoraisifsp/Conta.java
Created October 16, 2018 14:00
Show Gist options
  • Save hirayGui/24b06d9cf3271adfbe7b1e720d3ae3ca to your computer and use it in GitHub Desktop.
Save hirayGui/24b06d9cf3271adfbe7b1e720d3ae3ca to your computer and use it in GitHub Desktop.
Exemplo: Classe conta
package banco;
public abstract class Conta {
private float saldo;
protected void setSaldo(float valor) {
this.saldo = valor;
}
public float getSaldo() {
return this.saldo;
}
public abstract void depositar(float valor);
public abstract void retirar(float valor);
public void transferirPara(Conta outraConta, float valor) throws Exception {
this.retirar(valor);
outraConta.depositar(valor);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment