Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hi Pankaj, Performance wise which one is better: 1) if then … else 2) switch 3) ternary operator
- Abhi
1. mostly use switch which is more efficient 2. if you can’t use switch in some cases like non-matching stuff of strings use if… elseif…else 3.use ternary rarely in easy & simple cases eg : if (a == true) { sop(“true”); else { sop false } a = (a = true) ? “true” : “false”; don’ t use in cases like : int age = 29; if (age < 13) { System.out.println(“You are but a wee child!”); }// end if for age < 13 else if (age < 19) { System.out.println(“You are no longer a child, but a budding teenager.”); } // end else if for age < 19 else { if (age < 65) { System.out.println(“You are an adult!”); }// end if for age < 65 else { System.out.println(“You are now a senior, enjoy the good life friends!”); } // end if for nested else System.out.println(“Also, since you are over the age of 19, you deserve a drink!”); }// end of final else
- sriram.c
Switch case is better than if else in performance wise. Ternary operator is better for simple conditions.
- anil reddy
System.out.println(“You guys reason well. That’s why i believe you are programmers.”);
- Adam