Demo entry 1459876

Java code

   

Submitted by anonymous on Mar 04, 2015 at 00:28
Language: Java. Code size: 447 Bytes.

public class Entero {

    private int a;

    public Entero(int a) {
        this.a = a;
    }

    public Entero adicionar(int b) {
        this.a = this.a + b;
        return this;
    }

    public Entero adicionarSinES(int b) {
        return new Entero(this.a + b);
    }

    public int valor() {
        return this.a;
    }

    @Override
    public String toString() {
        return Integer.toString(a);
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).