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
| package codeCamp; | |
| import java.util.HashMap; | |
| public class contemOuVazio { | |
| void main(){ | |
| //Como verificar se um mapa hash contém um item ou se está vazio? | |
| HashMap<String, Double> preco = new HashMap<>(); | |
| preco.put("apple", 2.0); |
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
| package codeCamp; | |
| import java.util.HashMap; | |
| public class hashMap { | |
| void main(){ | |
| HashMap<String, Double> prices = new HashMap<>(); | |
| prices.put("maçã", 2.0); | |
| prices.put("Laranja", 1.8); |
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
| package codeCamp; | |
| import java.util.ArrayList; | |
| public class removerElementos { | |
| void main(){ | |
| ArrayList<Integer> numeros = new ArrayList<>(); | |
| for (int i = 0; i <= 10; i++){ |
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
| package MeusProjetos; | |
| public class multiplicandoPorCinco { | |
| public static void main(String[] args){ | |
| int numero =5; | |
| for (int multiplicar = 1; multiplicar <=10; multiplicar++){ | |
| System.out.println(String.format("%d x %d = %d", numero, multiplicar, numero * multiplicar)); |
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
| package MeusProjetos; | |
| public class comparandoMatrizes { | |
| public static void main(String[] args){ | |
| int numerosImpares1[] = {1, 3, 5, 7 ,9, 11, 13, 15}; | |
| int numerosImpares2[] = {1, 3, 5, 7 ,9, 11, 13, 15}; | |
| System.out.println(numerosImpares1 == numerosImpares2); //false | |
| } |
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
| package MeusProjetos; | |
| public class comparandoMatrizes { | |
| public static void main(String[] args){ | |
| int numerosImpares1[] = {1, 3, 5, 7 ,9, 11, 13, 15}; | |
| int numerosImpares2[] = {1, 3, 5, 7 ,9, 11, 13, 15}; | |
| System.out.println(numerosImpares1 == numerosImpares2); //false | |
| } |
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
| package MeusProjetos; | |
| import java.util.Arrays; | |
| public class preencherMatriz { | |
| public static void main(String[] args){ | |
| char vogais[] = {'e', 'u', 'o', 'i', 'a',}; | |
| int startIndex = 1; | |
| int endIndex = 4; |