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 Program{ | |
public static void main(String[] args){ | |
System.out.println("Hello world"); | |
} | |
} |
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 TestConversion{ | |
public static void main(String[] args){ | |
float floatingPoint = 3.14f; | |
double salary = 1270.50; | |
int value = (int) salary; | |
System.out.println(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 TestFloatingPoint{ | |
public static void main(String[] args){ | |
double salary = 1250.70; | |
System.out.println("My salary is " + salary); | |
double division = 5.0 / 2; | |
System.out.println("division: " + division); | |
} | |
} |
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 TestVariables { | |
public static void main(String[] args) { | |
int age = 37; | |
System.out.println("The age is " + age); | |
} | |
} |
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 TestCharacter{ | |
public static void main(String[] args){ | |
char letter = 'a'; | |
System.out.println(letter); | |
char value = 65; // It works! | |
System.out.println(value); | |
//value = (char) (value + 1); // Not works! | |
//System.out.println(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 TestaCondicional { | |
public static void main(String[] args) { | |
System.out.println("testando condicionais"); | |
int idade = 18; | |
int quantidadePessoas = 3; | |
if (idade >= 18) { | |
System.out.println("Você tem mais que 18 anos"); | |
System.out.println("Seja bem vindo"); |
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 TestaCondicional2 { | |
public static void main(String[] args) { | |
System.out.println("testando condicionais"); | |
int idade = 16; | |
int quantidadePessoas = 3; | |
boolean acompanhado = quantidadePessoas >= 2; | |
if (idade >= 18 && acompanhado) { | |
System.out.println("Seja bem vindo"); |
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 Fatorial { | |
public static void main(String[] args) { | |
int fatorial = 1; | |
for (int i = 1; i < 11; i++) { | |
fatorial *= i; | |
System.out.println("Fatorial de " + i + " = " + fatorial); | |
} | |
} | |
} |
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 MultiplosDeTresAteCem { | |
public static void main(String[] args) { | |
for (int i = 3; i < 100; i += 3) { | |
System.out.println(i); | |
} | |
} | |
} |
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 TestaEscopo { | |
public static void main(String[] args) { | |
System.out.println("testando condicionais"); | |
int idade = 20; | |
int quantidadePessoas = 3; | |
boolean acompanhado = false; | |
if (quantidadePessoas >= 2) { | |
acompanhado = true; |
OlderNewer