I'm trying to parse commandline args using a giant if-else if-else block. Right now, i'm just trying to get it working by displaying the "help" block (tested works fine). Whenever I run the program, it executes the else segment... public static void main(String[] args) { for (String s: args){ //DebugCode System.out.println(s); System.out.println(args[0]); } if (args.length < 1){ interactive(); } else{ try{ //TODO fix String dummy; String command = String.valueOf(args[0]); if (command == "-h" || command == "--help"){ help(); }else if (command == "-p" || command == "--push"){ //push dummy = "dummy"; }else{ //Invaled option System.out.println("Unknown operating mode. Please restart the program"); } } catch(Exception ex){ System.out.println("Error: " + ex.getStackTrace() + ex.getMessage()); } finally{ } } } running the program with the -h CLI arg in eclipse prints -h in the first two debuglines, but as soon as it gets to the if-else block, it executes the else...any suggestions? I've also tried args[0] inplace of command