Does the code
int value = 5;
if(value==5)
System.out.println("value is 5");
if(value==6)
System.out.println("value is 6");
actually compute faster than
int value = 5;
if(value==5)
System.out.println("value is 5");
else if(value==6)
System.out.println("value is 6");
?
I would assume that it is faster, based on its name and all, but is that actually how it works? When translated to machine code, does it run faster?
If I had thousands of lines of code, would a program using "else if" run faster than one using only "if" statements? If so, by how much?
PS: I'm using Java but I think this applies to all languages