Hi,

I am a newbie to Java and all new to programming.

Here I have a java program:

public class file_io {
public static void main (String args[]){

try{
String str;
System.out.println("Print this before exception\n");
str = args[0];
if (str == "abc"){
System.out.println("arg[0] value = "+str);
}

else{
System.out.println("Should not be printed if exception has occured in bove statement: str = args[0]");
}

}catch(Exception e){
System.out.println("Command Line Arguement is not passed");
System.out.println("Exception return value "+e+".");
}
}
}


I am compiling and running above program from CLI. I am passing parameter as abc through CLI. I am expecting my o/p as the print message inside if loop since I am passing parameter = abc which is matching str == "abc". But I get below o/p.
"Print this before exception

Should not be printed if exception has occured in bove statement: str = args[0]"

Can anyone please help me with the logic?