My enum type is not being changed from its default "null" value when displayed by a basic toString method. When the user inputs JPG,GIF, etc the if statement is supposed to recognize that the inputted string corresponds to enum. Why is the if statement not taking the user's input and converting it to match the enum?
public static void processPhotos()
{
String value;
String size;
String name;
String strType;
double dSize;
String photographer;
int iValue = 1;
Scanner kb = new Scanner(System.in);
while(iValue>0)
{
System.out.print("Enter the Photo's name.");
name = kb.nextLine();
System.out.print ("\nEnter the Photo's type(JPG, GIF, PNG, BMP, or OTHER).");
strType = kb.nextLine();
strType = strType.toUpperCase ( );
if(strType == "JPG")
{
type = Type.JPG;
}
if(strType == "GIF")
{
type = Type.GIF;
}
if(strType == "PNG")
{
type = Type.PNG;
}
if(strType == "BMP")
{
type = Type.BMP;
}
if(strType == "OTHER")
{
type = Type.OTHER;
}
System.out.print("\nEnter the Photo's size(IN Megabytes)");
size = kb.nextLine();
dSize = Double.parseDouble (size);
System.out.print("\nEnter the Photo's Photographer");
photographer = kb.nextLine();
Photo p = new Photo(name,type,dSize,photographer);
System.out.print (p.toString());
System.out.print("\n\nEnter an integer greater than zero to continue. Enter ZERO to end.");
value = kb.nextLine();
iValue = Integer.parseInt(value);
}
}