ALL
A boolean value interview question
Someone asked a question on StackOverflow, he was asked an interview question. The question is : Given 3 boolean variables a, b, c, return true if at least 2 out of the 3 are true. He gave the solution as follows :boolean atLeastTwo(boolean a, boolean b, boolean c) { if ((a && b) || (b && c) || (a && c)) { return true; } else { return false; }}Then the interviewer asked him to improve the solution given and ma...
6,581 0 RETURN EXPRESSION BOOL CONDITIONAL
Bill Gates to return as Microsoft's white knight?
Summary: Could and should Bill Gates return to day-to-day responsibilities at Microsoft? Fortune is reporting there’s a rumor to that effect. Fortune reported on December 8 that there’s talk Microsoft Chairman Bill Gates might be mulling a comeback, largely to help boost Microsoft’s stagnant stock price and employee morale.I have to say I am very, very, very skeptical on this one.First, it seems this is a single-sourced report. Fortune says: “One prominent chief executive told Fortune he’d heard from someone close to Gat...
2,590 0 RETURN MICROSOFT CHANGE BILL GATES WHITE KNIGHT
A return to good code
Stop doing this:public boolean foo() { if (true) { return true; } else { return false; }}It always amazes me when I dig into an open source project, and I see code written by supposed experts, and reviewed by seasoned professionals, and nobody slaps the wrists of the developer who shoves return statements right in the middle of a method.Tell me, how hard is it to do this:public boolean foo() { boolean flag = true; if (true) { flag=true; } else { flag=...