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
| class Pato { | |
| String nome; | |
| public Pato(String nome) { | |
| this.nome = nome; | |
| } | |
| public void grasnar() { | |
| System.out.println(nome + ": Quack Quack!"); | |
| } |
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.Scanner; | |
| public class main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| String placa = sc.nextLine(); | |
| if (placa.matches("[A-Z]{3}[0-9]{4}")) { | |
| System.out.println("Padrão: Brasil;"); |
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.Arrays; | |
| public class main { | |
| static class Espiral{ | |
| public int[][] gerarCaracol(int n) { | |
| int[][] matrix = new int[n][n]; | |
| int top = 0, bottom = n - 1; | |
| int left = 0, right = n - 1; |
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
| SELECT cli.CDCLINOME, ate.LCADATAHORAATEND | |
| FROM LCATENDIMENTO AS ate | |
| INNER JOIN CDCLIENTE AS cli | |
| ON ate.LCACLIENTE = cli.CDCLICODIGO | |
| WHERE | |
| ( | |
| ate.LCADATAHORAATEND >= '2011-01-01' | |
| AND ate.LCADATAHORAATEND < '2011-03-01' |
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
| SELECT cli.CDCLICODIGO, cli.CDCLINOME | |
| FROM CDCLIENTE AS cli | |
| INNER JOIN LCATENDIMENTO AS ate | |
| ON ate.LCACLIENTE = cli.CDCLICODIGO | |
| GROUP BY | |
| cli.CDCLICODIGO, cli.CDCLINOME | |
| HAVING | |
| COUNT(*) > 3; |
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
| SELECT | |
| cli.CDCLINOME AS nome_cliente, | |
| ate.LCADATAHORAATEND AS data_hora_atendimento, | |
| fun.CDFNOME AS nome_funcionario | |
| FROM LCATENDIMENTO AS ate | |
| INNER JOIN CDCLIENTE AS cli | |
| ON ate.LCACLIENTE = cli.CDCLICODIGO | |
| INNER JOIN CDFUNCIONARIO AS fun |
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 main { | |
| public static String center(String text, int width) { | |
| if (text.length() >= width) return text; | |
| int leftPadding = (width - text.length()) / 2; | |
| StringBuilder sb = new StringBuilder(); | |
| sb.append(" ".repeat(leftPadding)); | |
| sb.append(text); |
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
| SELECT CDCLICODIGO, CDCLINOME, CDCLIENDERECO, CDCLIUF, CDCLIATIVO | |
| FROM CDCLIENTE | |
| WHERE CDCLIUF = 'ES' AND CDCLIATIVO = 'F'; |
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.Scanner; | |
| public class main { | |
| public static boolean isPerfeito(int n) { | |
| int soma = 0; | |
| for (int i = 1; i <= n / 2; i++) { | |
| if ((n % i) == 0) { | |
| soma += 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
| import java.util.Scanner; | |
| public class main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| System.out.print("Digite um valor inteiro: "); | |
| int valor = sc.nextInt(); | |
| System.out.println("\nNOTAS:"); |
NewerOlder