This file contains hidden or 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.PrintStream; | |
| import java.net.Socket; | |
| import java.util.Scanner; | |
| public class Cliente { | |
| public static void main(String[] args) throws Exception { | |
| try ( | |
| Socket servidor = new Socket("127.0.0.1", 8080); |
This file contains hidden or 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 Programa { | |
| public static void main(String[] args) { | |
| Thread t1 = getThread("Thread 01"); | |
| Thread t2 = getThread("Thread 02"); | |
| t1.start(); | |
| t2.start(); | |
| } |
This file contains hidden or 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.*; | |
| public class CollectionsFramework { | |
| public static void main(String[] args) { | |
| listas(); | |
| ordenacao(); | |
| sets(); | |
| maps(); |
This file contains hidden or 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.*; | |
| import java.util.Scanner; | |
| public class IO { | |
| public static void main(String[] args) { | |
| copy("IO.java", "IO.copy.java"); | |
| } | |
| public static void copy(String inputName, String outputName) { | |
| try ( |
This file contains hidden or 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 LabeledLoop { | |
| public static void main(String[] args) { | |
| i_loop: | |
| for (int i = 0; i < 10; i++) { | |
| j_loop: | |
| for (int j = 0; j < 10; j++) { | |
| if (i == 5 && j == 6) break i_loop; | |
| System.out.printf("(%d, %d)\n", i, j); |
This file contains hidden or 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
| /** | |
| * Classe que representa um número natural. | |
| * | |
| * Dica 01: Todo classe pública deve ser escrita em um arquivo que possui o mesmo nome. | |
| * Caso o nome da classe fosse apenas "Numero.java" ou o nome da classe fosse | |
| * apenas "Numero", o compilador reclamaria! | |
| */ | |
| public class NumeroNatural { | |
| /** |
This file contains hidden or 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 Caminhao extends Veiculo { | |
| private double capacidadeCarga; | |
| private int anoModelo; | |
| public Caminhao (String modelo, String placa, int anoFabricacao, int anoModelo, double capacidadeCarga, double valor) { | |
| super(modelo, placa, anoFabricacao, valor); | |
| atribuirAnoModelo(anoModelo); | |
| atribuirCapacidadeCarga(capacidadeCarga); | |
| } | |
| public void atribuirAnoModelo (int anoModelo) { |
This file contains hidden or 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
| /* | |
| Algoritmo retirado de: http://www.gabaritodematematica.com/quantidade-de-divisores/ | |
| */ | |
| #include <iostream> | |
| #include <cstdlib> | |
| #include <unordered_map> | |
| using namespace std; |
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <style> | |
| #loaded-images { | |
| display: flex; |
This file contains hidden or 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.*; | |
| public class BotasPerdidas { | |
| public static void main(String[] args) { | |
| final int TAMANHOS = 50 - 30 + 1; | |
| Scanner scanner = new Scanner(System.in); | |
| while (scanner.hasNextInt()) { | |
| int quantidade = scanner.nextInt(); |