Вы находитесь на странице: 1из 23

Stack Exchange log in | careers | chat | meta | about | faq

Stack Overflow

Questions Tags Users Badges Unanswered Ask Question

Any good interview questions to ask prospective Junior java developers? [closed]

Does anyone have a good interview question to ask prospective junior java developers? They will have a two year minimum experience requirement. The questions will be on a written test and they will have five to ten minutes to answer each question. up vote 26 down vote favorite 45 share [g+] share [fb] share [tw] Limit to one interview question per response for voting purposes please. java interview-questions asked Sep 16 '08 at 13:31 link|improve this question Chris 149136 Was this post useful to you?

closed as not constructive by McDowell, casperOne Dec 1 '11 at 18:58

This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion. See the FAQ for guidance on how to improve it.

26 Answers
active oldest votes Compare and contrast (don't you love that phrase?) the modifiers public, private, protected and default. Compare an interface to an abstract class and give an example of when you might use one of each. What does the modifier final mean to a class and a variable? What is overloading and why might you use it? What is garbage collection and how does it work in java? How do you make a Thread in java? Write a generic main method and explain what each item in the method signature means. Explain how try/catch/throw/finally work. What is an Iterator and how do you use it? What are generics? Are these lines of code valid and describe why or why not:
List<Object> myList = new ArrayList<String>(); \\(hint: no) Map<Integer> myMap = new HashMap<int>(); \\ (hint: also no)

up vote 33 down vote accepted

answered Sep 16 '08 at 16:13 link|improve this answer 18Rabbit 1,15711020 In addition to your overloading question, I'd include what is overriding and when you would use it, or "what is the difference between overriding and 1 overloading?" Also, if Java 5 is included, what is a covariant return? MetroidFan2002 Jan 23 '09 at 14:49

The list includes about 6 questions that I was asked for a Java developer position. +1! codingbear Jul 7 '09 at 0:22 the example lines wouldn't compile even if correct as the comments are the wrong way around \\ when they should be //. Reminds me of a C puzzler 3 someone set me in interview once where the problem was a trick question. int a, *b, *c; *c = *a/*b .. why doesn't it compile? because / starts a comment. chillitom Sep 25 '09 at 14:24 feedback 3

Avoid you-know-it-or-you-don't questions about the Java API. These are worthless, IMO. My favourites are questions that ask for value judgements, because they allow good candidates to show their insight without necessarily having to have gained familiarity with particular parts of the API (which is what Javadoc is for, after all...) My favoured technical question is to get the interviewee to implement the equals method for a simple class with a couple of fields, and in the case of a face-to-face interview to defend their implementation (which will pretty much always be nonoptimal or missing something). Other questions I'd consider at least sprinkling into the list would include things like: "What feature would you most like to see added to Java?", "How would you go about debugging a NullPointerException?", "In a twenty-lecture training course on Java, in which lecture should the concept of object orientation be introduced, and why?", "How up vote does Java differ from other programming languages you've worked with?", and general 19 language-agnostic questions like "Why are patterns a good thing?", "Should good code down be self-documenting, or is it the responsibility of the developer to document it?", and the vote suchlike. Mostly I'm not looking for a right answer as such with a lot of these questions. I'm looking for an understanding of the question, a coherent chain of thought behind it, the ability of the interviewee to defend their viewpoint, and the ability to go beyond the simple multiple choice API questions that got them their JCP qualification that's no doubt taking pride of place on their CV. They can learn the parameters to String#regionMatches later, or just let their IDE provide the list every time for all I care. answered Jan 23 '09 at 13:30 link|improve this answer

Adrian 635819 feedback You attempt to run a bunch of compiled Java code that someone else gave you, and you see the following near the start of a stack trace:
NoClassDefFoundError: org.apache.commons.lang.StringUtils.

up vote What went wrong? How can you fix it? 10 down answered Sep 16 '08 at 13:39 vote link|improve this answer Jim Kiley 2,32421121 feedback Have them write code! Fizzbuzz is a good quick test... http://www.geekschool.org/programming/fizzbuzz/ up vote 9 down vote link|improve this answer Jody 986514 feedback Ask them to do OOAD of a given system description in 10 minutes. Observe how they tackle the problem. answered Sep 16 '08 at 13:37 up vote 5 down vote link|improve this answer Koh Wei Jie 21336 feedback up vote 5 Write some Java code with obvious errors. Inside the code you place innocently a '==' down comparison of objects instead the correct '.equals()'. (Be sure that the compared objects answered Sep 16 '08 at 13:35


in memory are different and the code fails, else the candidate may claim optimization). If you haven't programmed in Java a while (especially if you come from C/C++ !) you simply don't see the error ! It is a warning sign if someone claims long experience and can't detect this error because it is a real pain in the ass when you learn Java. link|improve this answer answered Sep 16 '08 at 14:48 TSK

feedback Ask what is the difference between an ArrayList and a Vector, a HashMap and a HashSet. up vote 4 down vote answered Sep 16 '08 at 13:40 link|improve this answer mmattax 7,7011557105 feedback I believe that more important than pure technical knowledge is the ability to communicate complex technical issues to someone who doesn't have a technical background. It's much, much easier to teach specific programming skills to someone who communicates very well than to teach communication to a pure techie. To that end, my favorite question is: "Pretend that I am your grandmother (or other up vote non-technical person). Explain to me what it means for a program to be object 4 down oriented." vote Remember--this is all about communication. Ask your technical questions too, but teaching communication is much more difficult than teaching programming. link|improve this answer answered Sep 16 '08 at 20:55 mring

up vote 3 down vote

It might be just that I have bad communication skills, but I find that Art majors cannot be "taught" programming. Simply because they have not interest in it, they are great communicators though. whatnick Sep 24 '09 at 14:29 +10 for this one! Simone Gianni Jul 21 '11 at 20:14 feedback Ask, how hashtable works. link|improve this answer answered Sep 17 '08 at 5:13

stepancheg 1,31311019 feedback Ask when will the finally block not get called? answered Oct 10 '10 at 23:38 up vote 3 down vote link|improve this answer edited Oct 11 '10 at 2:07 fastcodejava 11.4k32050 I've always thought that this is a little overly picky. C. Ross Oct 11 '10 at 14:22 You will be surprised by how many java developers with 5+ years experience 2 don't get this one right. ChristiaanP Dec 15 '10 at 8:49 When will it not get called? When System.exit() is called before it can be reached? Gravity Sep 5 '11 at 2:50 feedback Explain what it means to write "state-less" code? How does this relate to a multithreaded application? Give examples of how you'd write a state-less component. 1 answered Sep 16 '08 at 13:41 up vote 2 down vote link|improve this answer Michael 611 I think this question is more on par for a mid level position than a junior one. amischiefr Sep 24 '09 at 14:36 feedback 1 I must've interviewed a hundred or more developers and my advice is to start with practical coding questions. Even simple code tests will save you a lot of time. Most of the people I have interviewed could answer theory questions quite well, but only a up vote small fraction are what I would call good coders. 2 down vote For example, I generally start with the following question: "Given an array of ints, write some code that creates an another array of the same size

and copies the elements to the new array but in the reverse order." I imagine that most readers would consider this question ridiculously easy, but I found that nearly three quarters of interviewees struggled with this test. If they got past that question, I would ask them to repeat the task, but this time they should reverse the elements in place. The answer should be something like:
for (int i=0; i < (data.length / 2); i++) data[i] = data[data.length - 1 - i];

The first time through nearly everyone misses that you should only go half way through the array. Watching them fix that bug gives you a good inkling as to how they solve problems and how sharp they are. Next I would usually get them to sort the array using bubblesort, but by this stage I usually have a reasonably good sense of whether they are worth hiring. Total interview time using this method: 10-15 mins. Continue with theory or tool questions afterwards if you like, but I cannot recommend enough starting with the practical coding portion of the interview. link|improve this answer answered Sep 16 '08 at 14:34 BigBadaboom

I think your solution to the "reverse elements in place" problem is wrong... 8 running the code on [1,2,3,4,5,6] would result in [6,5,4,4,5,6]. Rob Dickerson Sep 16 '08 at 14:55 Rob is right, you won't hire yourself ;) Guillermo Vasconcelos Sep 16 '08 at 3 17:20 Ummm, I vote you down by mistake, sorry. Having said that, as Rob said, your code example is wrong. You need to take into account whether the size of the array is odd or even and from there, select the appropriate pivot point where the for loop stops. luis.espinal Oct 14 '10 at 16:10 feedback The best (only?) way to get an idea of someones ability to program is to sit down with them and program with them. If you are too busy to do this, ask some of the developers the candidate will be working with to do it. Better still is to get them to pair with several different developers. up vote 2 down Ideally choose a problem that has a recursive element to it. That is usually a good test vote of a programmers aptitude, or rather, if they can't do recursion, they would fail the interview if I was testing them. Let the candidate type, and work with them to solve the problem. Test driven development works well, especially if they haven't done it before, as it will take them

out of their comfort zone. You can learn a lot by how many shortcut keys they know in eclipse/ netbeans etc. No single question is going to tell you yes or no. You might get a kick-arse c# or C++ developer who would fail 'simple' java questions, but is a far better programmer than the java candidates - java ain't that hard to pick up, good, intelligent programmers are... answered Sep 16 '08 at 23:38 link|improve this answer David Turner 9272918 feedback We interviewed someone claiming to have Java web development experience. I asked what the difference between servlets and jsp was, that left him completely stumped. up vote 2 down vote answered Sep 24 '09 at 14:31 link|improve this answer whatnick 2,843317 feedback "Google and Microsoft do this" - you talk about companies as though they are people. Put the ego and college-beasting desires away. The only place teasers have is testing people with no real experience of your business e.g. interns/college-hires. You're looking for someone to work with right? Unless you're in the round-vs-square manhole business, ask people to approach one of your real problems (past or present). answered Sep 16 '08 at 21:08 link|improve this answer edited Dec 18 '10 at 11:50 stephbu 3,770726 feedback up vote 2 That should keep you busy ;) down

up vote 2 down vote


OO Concepts What is a strongly typed language? What is OO? Give a few reasons for using Java? Is java a pure object-oriented language? Why Java doesnt support multiple inheritances? What is JVM? What is JRE? What is the advantage of OO principles? What is coupling? What is low coupling? What is decoupling? Why would you want to decouple? What is cohesion? What are the four pillars of OO? What is inheritance? What is polymorphism? Can you identify different sub categories of polymorphism? Why do you use polymorphism? What is abstraction? Why do you use abstraction? What is Encapsulation? Whats the difference between constructors and methods? What is constructor chaining? What do we call a method signature? What is overloading? What is overriding? What is the limitation involved when overriding? What is the difference between an argument and a parameter? What is pass (or call) by reference? What is call (or pass) by value? Java Core Does Java call by reference? Why did the Sun engineers decided to make Java only call by value? How do you fake call by reference in Java, or more precisely, how can a callee influence the values of its callers variables? What are the use of this and super keywords? What is a class? What is a concrete class? What is an abstract class? What is an interface? What are the specificities of an interface? What are the differences with an abstract class? What are the limitations imposed by interfaces? Why an interface has its variables marked final and static?

What is a marker interface? Why would you use an abstract class or interface? Why interface attributes are static final? What are the differences between 1.4 and 1.5? Can an application have multiple classes having main method? Can you explain the usage of Java packages? Can I import same package/class twice? Will the JVM load the package twice at runtime? What are the different access levels in java? What are class variables and instance variables? Do you have to initialize instance variables? And local variables? If yes, what happens if you dont? What are the default values of instance variables for primitives and reference types? What are the different scopes for Java variables? What is lazy instantiation (or lazy initialization)? Why would you use lazy initialization? What is lazy evaluation? What is eager or greedy evaluation? What is static in java? How can one prove that the array is not null but empty using one line of code? What are wrapper classes? Why do we need wrapper classes? What is autoboxing? When should you use autoboxing and unboxing? What is the Locale Class? What are the Object class methods? Whats the difference between == and equals() method? What does equals do by default? What are accessors and mutators? How do you use them? What is the difference between StringBuffer and String class? How does String work behind the scene? Why would you use StringBuffer instead of normal String? Whats the difference between == and equals method with strings? What is an immutable object? Give example of immutable classes in Java? How would you make your own immutable class? Why and how would you return an Immutable result from a method? Why would you make an object Immutable? How would you make a copy of an entire Java object with its state? What is Cloneable? Why would you clone an object? What does the default protected clone do? What is a shallow copy? How would you make a copy of an entire Java object with its state if it is not Cloneable?

What is a deep copy? What is deep and shallow clone? What is the difference with deep and shallow copy? What is the difference between final, finally and finalize? Define them? Can finalize be called several time by the garbage collector? Why would you mark a class abstract and final? What is a ternary Condition in java? Write an example Why would you use ternary condition statement? Can you write examples of the use of ternary condition?

Strings What are String Literals and String Constant Expression? Write a class to count occurrences of one string in another string? Given a string, find its first non-repeating character? Garbage Collection What is the purpose of garbage collection in Java? When is it used? Describe, in general, how it works? Do you know more details about the garbage collector? What is a reference object? What are the different types of reference object? What do they define? What is a strong reference? What is a soft reference? What is a weak reference? What is a weakly reachable reference? What is a phantom reference? What is the difference between soft and weak reference? Enums What is an enum? What are the methods defined in enum class? Give an example where you would use an enum? Why? What are the advantages of enum? What are the disadvantages of enum? Java collection framework What is a collection? Draw the structure of the core collection framework interfaces? Can you name some of the key classes in the collection framework? How does the java core collection framework works? What are the pros of the collection framework? Does the collection interface extends any interface? What is an enumeration? Does anything implements the Collection? How does the Collections class works? Can you name a few static methods of the Collections class? Can you name a few methods declared in the Collection interface? How does the Arrays class works?

How to convert an array to a list? How to convert an array to an arrayList? Can you name a few static method of the Arrays class? What is a Map? How does the JVM fetch an object when get(keyObject) is called? What collection uses hashcode()? What are the 5 rules when you override hashcode? What are the highlights of the equals() contract? Can you override hashcode method and leave equals method? And vice versa? If you override equals method without overriding hashcode, what could happen? What is the default implementation of equals(objectPassed) method in the object class? What is the default implementation of hashcode() method in the object class? What is the difference between Hashtable vs HashMap? What is the difference between a Vector and an ArrayList? Discuss the advantages and disadvantages of both? What ordered collection means? What sorted collection means? How do you sort collections? How does compareTo works? How does the Comparator interface works? What is the difference between Comparator and Comparable? Why would you use Comparator? How does the compareTo method works? How does HashSet works? How does this collection know if 2 object are duplicates? How does TreeSet works?

Generics What are generics? Why generics? What extends means when declaring generics? How can you declare the use of generics? Write 2 examples without the wildcard, explain them? What is the difference in using a wildcard in your method argument compare to not using one? Why would you choose to use or not use wildcard? Keywords, literals and uncommon terms What does strictfp means? What does native means? What does shadowing means? Is null a keyword? What is a delegate? Errors and Exceptions What is the hierarchy under the Throwable class?

What are the differences between checked and unchecked exceptions? Is Class Error unchecked or checked? Can you handle errors? Can you tell me more about unchecked exceptions? Can you tell me more about checked exceptions? Does the RuntimeException class extend Throwable class? Can you tell me more about Error Subclasses? If I write return at the end of the try block, will the finally block still execute? If I write System.exit (0); at the end of the try block, will the finally block still execute? Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written? How could Java classes direct program messages to the system console, but error messages, say to a file?

Inner Classes Can a class be marked as static? What's the difference between inner and nested classes? Why Use Nested Classes? What are the different types of Inner Classes? How do you instantiate an inner class from inside the outer class? And from outside the outer class? What are regular inner classes? Can you write a very simplified code of regular inner class structure? Can you write an example of inner class instantiated from outside its outer class? Can you write an example of inner class instantiated from within its Outer Class? How does an inner class reference itself or its outer instance? What are the member modifiers applicable to Inner Classes? What is a static nested class? Can you write an example of static nested class? What is an anonymous inner class? Can you write an example of anonymous inner class? Explain your code for this inner class? What are method-local inner classes? Why would you use method local inner classes? What rules apply to method local inner classes? Can an inner class declared inside of a method accesses local variables of this method? Can you write an example of method local inner class? Threads What is the difference between multi-threading and multi-processing? What is a green thread? What are native operating system threads?

What is a "semaphore"? If you define a thread A and a thread B in your application, how many threads of execution do you have? What is a thread? How does it work? What is a daemon thread? What method is used to create a daemon thread? What do you have to consider when using thread? (What can go wrong?) How do you define a thread? Can you name a few constructors for thread? What is the better, extending the thread class or implementing Runnable interface? Can you write some code where a thread implements runnable? Can you write some code where a thread extend Thread? What happens after you call the start method? What happens if you call the run method? What happens if you call the start method a second time? What are the different states of a thread? What does alive mean? isAlive method? What decide when a thread is running? What is the difference in threads between java 1.4 and 1.5? What static methods from the Thread class can you call to influence the scheduler? What non-static methods from the Thread class can you call to influence the scheduler? What methods from the Object class can you call to influence the scheduler? How does the sleep static method works? How does the wait method works? What are the differences between the wait and sleep methods? How do yield static method and priorities work? What is the difference between pre-emptive scheduling and time slicing? How does the join method work? What is a "race condition"? What is a "Monitor" in threads? What do object locks and the synchronize keyword do? Why do we use it? What do you have to do to protect data from concurrent access with synchronization? Why would you use a synchronized block vs. synchronized method? What other techniques than locks could we use? What is volatile? Why you want to synchronize only the bare minimum? Can threads calling non-static synchronized methods in the same class block each other? Can threads calling a static synchronized method and a non-static synchronized method block each other? What is a deadlock? What is a livelock? What is starvation?

Why do you have to be careful when you use thread safe list? Can you write a code to illustrate your explanation? What do you have to bear in mind when calling wait, notify, notifyAll methods? What is the difference between notify and notifyAll methods? Why would you want to use notifyAll instead of notify? What would you do to force continued waiting until a condition is met? Can you write a code where to 2 threads are interacting?

Serialization What is serialization (or deflating or marshalling)? How serialization works? Why would you serialize an object? What exception is thrown if you try to serialize an object that doesn't implement the serializable interface? How can you tell the compiler to not serialize an object? Explain the usage of the keyword transient? If a class is marked serializable, what is not going to be serialized during the serialization process? What do you have to consider when working with a serializable object? (What can cause trouble, NOT serializable fields) If you need the state of an object marked transient after the object it belongs to is deserialized, how do you do? How can you be sure that your object won't be deserialized in an instance of class having the same name but different implementation (version) the original class ? How do you serialize an object (code)? How you deserialize an object (code)? What is Externalizable? What is RMI? Do you know RMI more in depth? What is the structure of RMI? JDBC What is JDBC? Describe the steps needed to execute a SQL query using JDBC. What checked exception is/are thrown by executeStatement method? How do you execute multiple statements using jdbc? How can you make sure 2 queries are executed only if both of them do not throw any exception? How do you commit a query? And rollback? What is connection pooling? Can you write a code where you execute a query and process the result? Reflection What is reflection? Do you know more about reflection? Where and why would you use reflection? What are the disadvantages of reflection?

How do you instantiate a new object and call a method with reflection?

Design Patterns and UML Can you draw a UML Class Diagram for ...(describe a quick system/design)? What are design patterns? Which one do you know? Tell me about them? What is dependency injection? Give a conceptual definition for dependency injection? What is MVC? Why do we use MVC? Can you draw a schema of the interactions between each entity in MVC? Can you give examples where MVC is used? What is the singleton pattern? Can you give an example of use of the singleton pattern? How do you program the singleton pattern? What would you do to protect the static method to create concurrency problem? What is the factory pattern? Can you draw a UML diagram of the Factory pattern? Can you give an example of use of the factory pattern? How do you program the factory pattern? What is the Abstract Factory pattern? Can you draw a UML diagram of the Abstract Factory pattern? Can you give an example of use of the Abstract Factory pattern? How do you program the Abstract Factory pattern? What is the Adapter pattern? Can you draw a UML diagram of the Adapter pattern? Can you give an example of use of the Adapter pattern? How do you program the Adapter pattern? What is Composite pattern? Can you draw a UML diagram of the Composite pattern? Can you give an example of use of the Composite pattern? How do you program the Composite pattern? What is Mediator pattern? Can you draw a UML diagram of the Mediator pattern? Can you give an example of use of the Mediator pattern? How do you program the Composite pattern? What is the Proxy pattern? Can you draw a UML diagram of the Proxy pattern? Can you give an example of use of the Proxy pattern? How do you program the Proxy pattern? What is the Observer pattern? Can you draw a UML diagram of the Observer pattern? Can you give an example of use of the Observer pattern? How do you program the Observer pattern? What is the Command pattern?

Can you draw a UML diagram of the Command pattern? Can you give an example of use of the Command pattern? How do you program the Command pattern?

Other Programming Concepts What is CVS? Why we use it what are the benefits? What is a test suite? Why would you use design patterns in test suites? answered Nov 29 '11 at 13:02

link|improve this answer Adrien Be 1029 1 Poor candidate, having a 1 week long interview! assylias Mar 30 at 9:29 feedback Here is a common question that has worked well for me in the past (with answer of course). Develop a pseudocode program that prints the numbers from 1 to 100. But for multiples of three print "Ping" instead of the number and for the multiples of five print "Pong". For numbers which are multiples of both three and five print "Ping Pong".
public class Pingpong{ public static void main(String args[]){ for (int i = 1; i<=100; i++){ if(i%3 == 0 && i%5 == 0){ System.out.println("Ping Pong"); }else if(i%3 == 0 ){ System.out.println("Ping"); }else if (i%5 == 0){ System.out.println("Pong"); }else{ System.out.println(i); } } }

up vote 1 down vote

} answered Sep 16 '08 at 13:35 link|improve this answer Chris

149136 Looks like a variant of the "FzzBuzz" question. A developer with 2 years of work 1 experience should knock this out of the park. Scott A. Lawrence Sep 16 '08 at 13:39 (1..100).collect { it % 3 ? (it % 5 ? it : "Pong") : (it % 5 ? "Ping" : "Ping Pong") 1 }.each { println it } broady Sep 16 '08 at 13:46 @Scott A. Lawrence: 2 years experience? I cannot imagine any CS graduate that won't write it under couple of minutes. ya23 Sep 24 '09 at 14:45 1 @ya23: you'd be surprised... Legs May 1 '11 at 1:07 feedback What version(s) of java have you been using in the projects (you have 2 years experience after all)? answered Sep 16 '08 at 14:17 up vote 1 down vote link|improve this answer Vilmantas Baranauskas 1,3441820 And why is this a good question? talonx Apr 26 at 6:05 feedback First question: In a Java 5 or Java 6 platform, assuming the code compiles, what can you say about this class declaration? Any comments, opinions or criticisms?
public class Foo implements Comparable { // constructors, methods and stuff go here. public int compareTo(Foo foo){... does the comparison logic...} public boolean equals(Foo foo){ ... does equality test logic...} }

up vote 1 down vote Second question: In Java, independently of the version, why would you implement/override the hashCode() method? What can you tell me of the relationship of equals() and hashCode()? answered Oct 14 '10 at 15:52 link|improve this answer luis.espinal 2,185519

feedback You can give a simple scenario and ask them to give an OO based outline using classes and interfaces. The person should also be able to justify the design. up vote 1 down vote answered Dec 1 '10 at 8:31 link|improve this answer prasonscala 540116 feedback There are some great questions here - http://www.freejavaguide.com/java-interviewquestions.html I'd also prepare a logic test with brain teasers. Google and Microsoft do this. I need to know if my programmers and going to be nimble and quick when faced with a server crash, so I think brain teasers test for agility under pressure. answered Sep 16 '08 at 13:36 link|improve this answer Mike 96421018 NO! Stop the brain teaser madness!! Teasers test only one thing: are you good at 5 brain teasers? They don't test agility, nibleness, "thinking outside the box" or any other such nonsense. Josh Hinman Sep 16 '08 at 16:21 Brain teasers can give an interviewer quick insight into how well a person works under pressure and the way they think. It can also be a quick way to weed out bad 1 candidates, I've actually had people tell me the problem can't be solved. They have their place in interviews. Chris Sep 17 '08 at 19:28 I am all for teasers. They show adaptability and "nimbleness"(sp), great assets for a creative type. Without the problem solving ability a developer is not worth their salt. whatnick Sep 24 '09 at 14:27 If you want to test them with a server crash, then give them a server crash. "Here is 1 the stack trace (or the last 5% of it) - what would you do now?" Brain teasers is a pain. Thorbjrn Ravn Andersen Aug 17 '10 at 18:51 feedback up vote 0 One of many questions I like to ask junior Java programmers in order to get a feel for how well they know the general Java language concepts is: down vote

up vote 0 down vote

Explain when you would use each of the following: final, finally and finalize. answered Sep 16 '08 at 18:25 link|improve this answer mbaird 15k33755 feedback One general source for such questions comes from Sun itself: The Sun Java Certifications. up vote 0 Questions of those may be found in on-line trainings or tutorials. Feeling lucky(tm): http://www.javaprepare.com/notes/intro.html however there are still no Java 6 related down questions. vote link|improve this answer feedback List some design patterns already in use in the Java API and for each of them : 1. write a short sample code showing when or how to use it 2. describe it's strength and weakness if any 3. for any weakness, what would you change to make it better? It's easy to enumerate design patterns, but to know where they are in code and how to use them are two separate things. After all, applying theory is the idea behind up vote internships, and this will tell if the company will waste time and money if the latter is 0 down lacking. Also, the last point will show you what kind of judgement (constructive criticism, choice of recommendations, etc.) the candidate will make. vote answered Oct 11 '10 at 2:59 link|improve this answer Yanick Rochon 9,5321931 feedback up vote Q. - You have 12 cubes that all appear to be identical; however one cube is slightly 0 down heaver than the other 11 (you cant tell the difference by holding them). Also, you have vote a balance scale; unfortunately you can only use the scale three times. Can you tell me answered Sep 16 '08 at 22:28 Titus Fox

how you would find the heaver cube? A. First - Weight 6-6 each side in the scale then you will get the 6 cubes group which has one heavier cube Second - Weight 3-3 each side in the same way then you will get the 3 cubes group including the heavier one Third - Weight 1-1 each side then you will get to know which one is the heavier one ! Thanks, Deepesh answered Jul 25 '11 at 12:42 link|improve this answer Deepesh 1 The last use of the scale is a little trickier than the first two in that you can't divide the remaining cubes equally into two. The trick is to weigh only two of the remaining three, one on each side, and if they're both equal, the one you didn't weigh is the heavy one. (You seemed to imply this, but it's worth calling out.) Alan Krueger Jan 11 at 17:37 feedback how many constructors are present in class A { } answer 2 1)copy constructor 2)default constructor up vote -1 down vote link|improve this answer Asha 3,880315 -1, Since the question was about junior Java developers, your answer is incorrect. Alan Krueger Jan 11 at 17:33 feedback answered Dec 1 '10 at 8:03

Not the answer you're looking for? Browse other questions tagged java interview-questions or ask your own question.

java 248596 interview-questions 2307 asked 3 years ago viewed 18,358 times active 5 months ago

Tech Lead / Sofware Development Engineer III Flipkart.com Bangalore, India .Net Professionals (Engineers & Leads) Consindia. Pvt Mumbai, India Core Applications Engineer Tumblr New York, NY

18 People Chatting

Android People
12 hours ago - nikigx2

14 hours ago - Peter Rader

Linked Java web developer interview questions Related

Good 15 minute Java question to ask recent college graduate Senior Java EE interview questions Controlled set of technical interview questions Interview questions for Flash developers Whiteboard Interview Questions What are some important interview questions to ask prospective game testers? Interview questions for programming aptitude Computer Science questions during interview? If you could only ask 1 interview question for a programmer, what would it be? Any good resource for java interview questions? All job interview have questions about code and math? Java: Interview questions for software tester? interview questions for a test lead What are some programming interview questions which give a good indication of one's ability? Junior Developer Interview Questions About Interview structure for test automation lab developers Any good interview Questions to ask a sybase dba What are some good java interview questions and answers regarding generics and annotations? What are some good Java interview questions for a web application developer? questions i tripped on in an interview Java:Clarifications in Java Interview Questions Interview : Java Equals What are good questions to ask a sales engineer candidate? How many inner classes a class can have in java about | faq | new blog | chat | data | podcast | shop | legal | advertising info | mobile | contact us | feedback

stackoverflow.com api/apps careers serverfault.com superuser.com meta area 51 webapps gaming ubuntu webmasters cooking game development math photography stats tex english theoretical cs programmers unix apple wordpress physics home improvement gis electronics android security bicycles dba drupal sharepoint scifi & fantasy user experience skeptics rpg judaism
rev 2012.5.21.2626 site design / logo 2012 stack exchange inc; user contributions licensed under cc-wiki with attribution required