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
static void insertionSort(int[] ar) { | |
//variavel responsavel por conter o valor do ultimo indice. | |
int lastIndex; | |
//variavel auxiliar para conter o valor do elemento corrente. | |
int key; | |
for(int j = 1; j < ar.length; j++){ | |
//atribuindo valor elemento corrente. |
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.Arrays; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class ExemploLista { | |
public static void main(String[] args) { |
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
Output: | |
2, 4, 8, 12, 15, 19, 21, 24, 26, 29, 30, 32, | |
35, 36, 41, 44, 49, 52, 57, 58, 59, 64, 65, | |
68, 73, 77, 80, 82, 85, 88, 93, 97, 101, 101, | |
105, 108, 111, 115, 118, 122, 127, 130, 131, 132, | |
134, 135, 136, 138, 141, 144, 146, 151, 153, 158, | |
160, 165, 169, 171, 176, 179, 184, 187, 190, 194, | |
197, 200, 205, 210, 215, 217, 222, 225, 230, 231, | |
236, 239, 243, 244, 246, 248, 253, 254, 256, 258, |
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 interface Veiculo { | |
void andar(); | |
void ligar(); | |
void desligar(); | |
} |
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 Carro implements Veiculo { | |
public void andar() { | |
System.out.println("Carros andam em rodovias"); | |
} | |
public void ligar() { | |
System.err.println("Ligar com partida a combustão"); | |
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 Motocicleta implements Veiculo { | |
public void andar() { | |
System.out.println("Motos andam em rodovias"); | |
} | |
public void ligar() { | |
System.err.println("Ligar com partida a combustão"); | |
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 TesteInterface { | |
public static void main(String[] args) { | |
// Array de Objetos que implementam a interface Veiculo | |
Veiculo[] arrayDaInterface = new Veiculo[] { new Motocicleta(), | |
new Carro() }; | |
Carro c = new Carro(); | |
// Aqui preciso garantir que na posição 1 terá um carro utilizando um CAST , pois varias classes podem implementam veiculo e pertencer a este array e nao somente um Carro. |
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
[INFO] Scanning for projects... | |
[INFO] | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Building Maven Stub Project (No POM) 1 | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] | |
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>> | |
[INFO] | |
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<< | |
[INFO] |
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
Define value for property 'groupId': : br.com.mcarvalho.wsclient | |
Define value for property 'artifactId': : sample-project | |
Define value for property 'version': 1.0-SNAPSHOT: : | |
Define value for property 'package': br.com.mcarvalho.wsclient: : | |
Após isso será solicitado a confirmação, digite Y (yes) | |
Confirm properties configuration: | |
groupId: br.com.mcarvalho.wsclient | |
artifactId: sample-project |
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
[INFO] ---------------------------------------------------------------------------- | |
[INFO] Using following parameters for creating project from Old (1.x) Archetype: vraptor-archetype-webapp-blank:0.1.0 | |
[INFO] ---------------------------------------------------------------------------- | |
[INFO] Parameter: groupId, Value: br.com.mcarvalho.wsclient | |
[INFO] Parameter: packageName, Value: br.com.mcarvalho.wsclient | |
[INFO] Parameter: package, Value: br.com.mcarvalho.wsclient | |
[INFO] Parameter: artifactId, Value: sample-project | |
[INFO] Parameter: basedir, Value: C:\Users\mauriciosantos\Documents\GitHub\ws-client | |
[INFO] Parameter: version, Value: 1.0-SNAPSHOT | |
[INFO] project created from Old (1.x) Archetype in dir: C:\Users\mauriciosantos\Documents\GitHub\ws-client\sample-project |
OlderNewer