Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Animale {
- private int peso;
- public Animale(int peso){
- this.peso = peso;
- }
- public int getPeso() {
- return peso;
- }
- public void setPeso(int peso) throws Exception{
- if(peso > 0)
- this.peso = peso;
- else
- throw new Exception();
- }
- public void verso(){
- System.out.println("mmmmm");
- }
- public String toString(){
- return "Animale: "+this.peso;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement