Hi all, I have 2 segments of two different codes that are having problems and I can't seem to find what I am doing wrong. The first code has a logical error. Any ideas?
First code :
Scanner console = new Scanner(system.in); System.out.print("Type a number: "); int number = console.nextInt(); if (number % 2 == 0) { if (number % 3 == 0) { System.out.println("Divisible by 6."); } else { System.out.println("Odd."); } }
Second code :
Scanner console = new Scanner(System.in); System.out.print("What is your favorite color?"); String name = console.next(); if (name == "blue") { System.out.println("Mine, too!");