Question d’entretien chez Netflix

How does a garbage collection system work? How will you prevent an object from being garbage collected? Write N-ary tree traversal code to search a node given a String key. How many JVM instances does a tomcat server have? How would it handle multiple applications with different versions of same api (for instance log4j)? Explain wait and notify. Explain Generics. What is the difference between a static class and a singleton class? Why do you want to work for Netflix?

Réponses aux questions d'entretien

Utilisateur anonyme

28 sept. 2012

Answer to static vs singleton class question: First of all static classes don't exist in Java, only NESTED classes can be static (see http://stackoverflow.com/questions/3584113/java-static-class). Basically when an element of a class is declared static in Java, it can be accessed without having to instantiate the class itself. So the key concept is that no instantiation is needed. In the singleton the class needs to be instantiated but the key here is that the class can be instantiated only ONCE. It means that if you instantiate A then the next time you need to instantiate A again, your class will basically return the A you created first instead of creating a new A object. You use the Singleton pattern basically to avoid having duplicate objects existing at the same time (hence the word SINGLE in singleton. see http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html).

1

Utilisateur anonyme

12 avr. 2012

http://www.dofactory.com/topic/1173/difference-singleton-and-static.aspx