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
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import org.eclipse.jdt.core.dom.AST; | |
import org.eclipse.jdt.core.dom.ASTParser; | |
import org.eclipse.jdt.core.dom.ASTVisitor; | |
import org.eclipse.jdt.core.dom.CompilationUnit; | |
import org.eclipse.jdt.core.dom.MethodDeclaration; |
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
class Logger { | |
private Logger() {} // proíbe clientes de chamar new Logger() | |
private static Logger instance; // instância única da classe | |
public static Logger getInstance() { | |
if(instance == null) // primeira vez que chama-se getInstance | |
instance = new Logger(); | |
return instance; | |
} |
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
class Livro { | |
private String nome; | |
private String autores; | |
private String editora; | |
private String ano; | |
private Livro (String nome, String autores, String editora, String ano) { | |
this.nome = nome; | |
this.autores = autores; | |
this.editora = editora; |
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
import javax.servlet.*; | |
import javax.servlet.http.*; | |
import java.io.*; | |
class IMCModel { | |
public double calculaIMC(String p1, String a1) | |
throws NumberFormatException { | |
double p = Double.parseDouble(p1); | |
double a = Double.parseDouble(a1); | |
double imc = p / (a * a); |
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
import javax.servlet.*; | |
import javax.servlet.http.*; | |
import java.io.*; | |
import org.junit.*; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
import org.mockito.Mockito; | |
import static org.mockito.Mockito.when; |
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
import java.util.ArrayList; | |
import java.util.List; | |
abstract class Veiculo { | |
private String placa; | |
public Veiculo(String placa) { | |
this.placa = placa; | |
} | |
public String getPlaca() { | |
return placa; |
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
class TaskResult { | |
double value; | |
public synchronized void set(double value) { | |
this.value = value; | |
} | |
public double get() { | |
return value; | |
} | |
} |
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
public class Book { | |
private String titulo; | |
public Book(String titulo) { | |
this.titulo = titulo; | |
} | |
public String getTitulo() { | |
return titulo; | |
} | |
} |
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
import java.util.List; | |
import java.util.ArrayList; | |
public class Main { | |
public static void main(String[] args) { | |
// teste 1 | |
List<Integer> s = new ArrayList<Integer>(); | |
System.out.println(s.isEmpty()); | |
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
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
class Subject { | |
private List<Observer> observers = new ArrayList<Observer>(); | |
public void addObserver(Observer observer) { | |
observers.add(observer); | |
} |
OlderNewer