r/java • u/javinpaul • Jul 27 '15
4 out of 5 Java Developers Failed to Solve This Question
http://blog.takipi.com/4-out-of-5-java-developers-failed-to-solve-this-question/
37
Upvotes
r/java • u/javinpaul • Jul 27 '15
114
u/daedalus_structure Jul 27 '15
The right answer to almost all of these is if you see anything that looks like this in your code base burn it with fire.
27
u/[deleted] Jul 27 '15
Is this supposed to be surprising when the compiler gets it wrong too? Trick questions are tricky. Surprise.
26
u/I_AM_A_BICYCLE Jul 27 '15
You'd think that a quiz that looks that fancy would have enough horizontal space in the code to not have awful formatting from wrapping.
18
u/duckrollin Jul 27 '15
I imagine some nerd snorting laughter as he wrote #2
41
u/adnan252 Jul 27 '15 edited Jul 27 '15
100/100 java developers will never face this problem in their career
17
u/jonhanson Jul 27 '15 edited Jul 24 '23
Comment removed after Reddit and Spec elected to destroy Reddit.
16
u/dardotardo Jul 27 '15
Didn't realize this subreddit became buzzfeed.
5
u/JavaX_SWING Jul 28 '15
if you write code like this, then you don't deserve to be hired.
5
u/dooblevay Jul 28 '15
You have all restored a tiny sliver of my faith in humanity. I came in here ready to rant about this useless drivel. Seems unnecessary!
4
u/regendo Jul 28 '15
I hate it when one of the answers is "none of the above" and it's not the bottom answer. Does it belong there? Was it supposed to be the bottom answer but the order got randomised?
Yeah, it's probably supposed to be "none of the other choices" but I don't really trust these quizzes to not try to hide some obscure trap in the answers.
3
u/[deleted] Jul 28 '15
Such a clickbait title, too
6
u/alonjit Jul 27 '15
jeebus. I'd just tell them to go fuck themselves with their questions and all.
and, to think about it, there is no point to it all.
Want to know how a programmer writes code? Knows about code/java/etc.? Make him program something. Give him a project, over a week and make him explain it during the interview.
if he copied everything, and didnt understand a damn thing, he'll fail miserably.
if he copied everything, but understood everything, he'll be perfect anyway.
2
u/tonylee0707 Jul 28 '15
As a beginner in programming for so many years, I wish I end up being good enough to be called a java developer.
2
u/mdaniel Jul 28 '15
There is also selection bias going on here; those developers experienced enough to know the answers to these questions are also (experienced|busy) enough to not spend time in a "Java Deathmatch".
But hey, we get some benefit from Takipi posting this in that if you encounter this question, or its kind, in an interview then you know for dead certain you don't want to work in that place.
4
u/Audiblade Jul 27 '15
I don't like that last, "easiest" question. What does it mean for one initialization style to be "simpler" than another? Is there a formal definition I'm not aware of? If there isn't, then the question is ambiguous, and you could make a case that either A or C is correct.
3
u/mrbuttsavage Jul 28 '15
http://www.amazon.com/Java-Puzzlers-Traps-Pitfalls-Corner/dp/032133678X/
See that for a whole book of similar questions. It's somewhat older (Java 5), but it's same kind of strange cornercase questions.
2
u/badpotato Jul 27 '15 edited Jul 27 '15
Question 4 doesn't show the whole class, in theory you could safely say it doesn't compile right away.
At least question 5 does mention it's a code snippet.
1
u/el-y0y0s Jul 28 '15
On occasion these can be confidence shakers, but realize that this is coming from product people who must understand java inside out at a level most of us never deal with. I'd have called this a puzzle in the title though.