Skip to content

Instantly share code, notes, and snippets.

View LaurentiuGabriel's full-sized avatar
🚀
Working on an exciting project!

Laurentiu Raducu LaurentiuGabriel

🚀
Working on an exciting project!
View GitHub Profile
public class Application {
public static void main(String[] args) {
int left = 5;
int right = 6;
//Arithmetic Operators
System.out.println("Addition: " + (left + right));
System.out.println("Substraction: " + (left - right));
System.out.println("Multiplication: " + (left * right));
public class Application {
public static void main(String[] args) {
int left = 5;
int right = 6;
//Arithmetic Operators
System.out.println("Addition: " + (left + right));
System.out.println("Substraction: " + (left - right));
System.out.println("Multiplication: " + (left * right));
public class Application {
public static void main(String[] args) {
//Numeric primitives
int integerNumber = 1;
Integer integerNumberRef = 1;
short shortNumber = 32767;
Short shortNumberRef = 32767;
long longNumber = 373923;
Long longNumberRef = 3713923L;
public class App {
public static void main(String[] args) {
int myVariable = 55;
int [] myArray = new int[3];
int[] myArray2 = {1, 2, 3};
myArray[0] = 1;
myArray[1] = 2;
myArray[2] = 3;
public class Application {
public static void main(String[] args) {
int variable = 3;
if ((variable != 5) && (variable == 0)){
System.out.println("Variable is greater than five.");
}
else if (variable == 5){
System.out.println("Else if here.");
}
public class Application {
public static void main(String[] args) {
for(int i = 0; i < 5; i++){
System.out.println(i);
for(int k = 0; k < 5; k++){
System.out.println("This is the inner loop");
}
}
}
public class Application {
public static void main(String[] args) {
int value = 10;
do{
System.out.println("Value is: " + value);
value += 1;
}
while(value < 20);
}
public class Application {
public static void main(String[] args) {
String text = new String();
text = "Hello";
String newString = text + " World!";
String newString2 = text.concat(" World!");
Integer number = 26;
String numberStr = number.toString();
String text2 = "Hello2";
import java.util.Scanner;
public class App {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("You need to type something: ");
String input = scanner.nextLine();
System.out.println("User has typed: " + input);
System.out.println("You need to type integer: ");
import java.util.Scanner;
public class App {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("You need to type something: ");
String input = scanner.nextLine();
System.out.println("User has typed: " + input);
System.out.println("You need to type integer: ");