// Yazzy Latif // 06/26/2020 // TA: Grace Hopper // Expressions Examples // Some examples of expressions public class Expressions { public static void main(String[] args) { // Literal value System.out.println(2); System.out.println(4.5); System.out.println(); // Simple expressions System.out.println(3 + 5 + 1); System.out.println(10 / 4); // integer division System.out.println(17 % 5); System.out.println(6.2 + 1.3); System.out.println(2.0 * 2.5); System.out.println(); // Precedence System.out.println(3 + 5 * 2 / (3 + 1)); System.out.println(); // Mixing types System.out.println(2 + 3.4); System.out.println(3.0 / 5); System.out.println(7.0 + 3.0 * 1 + 5 / 2 * 2.5); System.out.println(); // String concatenation System.out.println("hi" + 1 + 2); System.out.println(1 + 2 + "hi"); System.out.println(1 + 2 + "hi" + 3 + 4); System.out.println("hi" + 3 * 5); System.out.println(); } }