Last active
August 29, 2015 14:03
-
-
Save target-trust/db9139e928f0433f68c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.targettrust.exemplos; | |
/* | |
Um exemplo simples de classe com um método main básico | |
que instancia vários objetos da classe, | |
manipula os objetos, e gera informações | |
sobre o objeto | |
*/ | |
public class ExemploSimples { | |
private int numero; | |
public ExemploSimples() { } | |
public void setValue(int val) { | |
number = val; | |
} | |
public int getNumero() { | |
return numero; | |
} | |
public static void main(String[] args) { | |
for(int i=0;i<10;i++) { | |
ExemploSimples exemplo = new ExemploSimples(); | |
if(i/2 <= 2) { | |
exemplo.setValue(i); | |
} else { | |
exemplo.setValue(i*10); | |
} | |
System.out.println("O valor de ExemploSimples #"+i+" é "+exemplo.getNumero()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment