Evil Java Interview Question

class Fruit { public Fruit() { init(); } protected void init() { } } class Orange extends Fruit { private String color = null; public Orange() { super(); } protected void init() { color = “Orange”; } }

If I create a new instance of Orange what is the variable ‘color’ set to? The answer is null.


Comments

Sean

2010-08-31T04:11:42.000Z

that one’s not too too bad. Sometimes the nastier interview questions can be the threading ones; in my opinion at least. Or if you go nuts with generics.

Loaded Gun Theory is a sponsored project of Austin Creative Alliance.

For more information on Austin performing arts visit Now Playing Austin.