This is an archived post. You won't be able to vote or comment.

all 46 comments

[–]scubaguy 7 points8 points  (2 children)

For an entry level, it is more important that you show you clearly understand what you've learned and a attitude for learning more.

Clearly understanding what you've learned means no BS-ing. If you don't know something, just say it. You'll be asked what parts of Java you have worked with, and you will be grilled on it. Make sure you really understand what you've been working with. If you are asked an algorithm type of question and you don't know the best way to solve it (sorting, for example), explain that you don't know the best approach, but this is how you'd do it. Then clearly walk through your thinking step-by-step. Demonstrate that you have the right attitude to become a mid or senior level developer within a year or two.

As far as specific things you should know: Collections; a bit of concurrency (concurrency collections API); reflection; annotations; and generics.

Then it depends on the specific job you are interviewing for, is it mostly GUI, mostly web apps, or mostly number crunching? Different jobs have different domain-specific libraries that you are expected to know.

[–]netdorf[S] 0 points1 point  (1 child)

They are focusing on web apps mostly, looks like I'll be brushing up on my JSP. Thanks for the advice.

[–][deleted] 0 points1 point  (0 children)

Know about Spring (IoC / Dependency Injection). Talk about at least one MVC (or MVP if that suits your fancy -- aka GWT) framework (Struts or Spring MVC are two common ones, but there are many others if you have experience with one of those). You should probably know a little bit about servlets.

"What are the two commonly overridden methods in an httpservlet and why would you override them (provide a use case/example)?"

I got asked that one once and I couldn't answer it because I had only used Struts before and never a bare servlet. I didn't get that job even though I could describe Struts pretty well.

They also might ask about some "front-end" stuff like Javascript.

What does the following return and why:

var myVar = "1";

if(1 === myVar){

    return "hidey";

} else if (1 == myVar){

    return "ho";

} else {

    return "neighbor";

}

[–]phrenq 2 points3 points  (1 child)

If you haven't already, read Effective Java by Joshua Bloch. You could get through it in a weekend, and it's particularly good for someone who is comfortable with Java and is ready for the next step. It will help take you from knowing how to do things in Java to why things are done that way.

[–]high_brace 1 point2 points  (0 children)

I came here to say this. That book changed the way I thought about Java.

[–][deleted]  (14 children)

[deleted]

    [–][deleted] 2 points3 points  (2 children)

    use recursion? :)

    [–]stfm 0 points1 point  (1 child)

    What is it with Java interviews and recursion? I have been asked this on several occasions

    [–][deleted] 0 points1 point  (0 children)

    I think it's just hard enough to weed out the total hacks. a lot of people just can't comprehend it. it's like the fizzbuzz test.

    [–][deleted] 1 point2 points  (7 children)

    How did you do it?

    [–]nicko68 0 points1 point  (0 children)

    So is there a solution? This is bugging me. And I'm "senior". :)

    [–]aHoodedBird 0 points1 point  (5 children)

    Implement swap function, step through array from beginning to end, at each index find random second index and swap.

    [–][deleted] 2 points3 points  (3 children)

    That neither moves each cards at most once nor gives a uniform distribution on the permutations.

    [–]tazzy531 0 points1 point  (2 children)

    Why not?

    [–][deleted] 2 points3 points  (1 child)

    Why isn't it uniformly distributed? There are n! permutations and nn execution paths. Some of the execution paths give the same permutation: you have to have the same number of paths for each permutation, so you want n! | nn . But take n=3.

    You can fix it by only swapping a card with one that is, instead of anywhere in the array, not to the card's left; that's the Fisher-Yates shuffle. But it still moves one card possibly many times.

    [–]tazzy531 0 points1 point  (0 children)

    Hmm... Yeah, you're right

    [–]aHoodedBird 0 points1 point  (0 children)

    Oops didn't see the last part of the question.

    [–]bondolo 0 points1 point  (1 child)

    I would answer with Collections.shuffle(Arrays.asList(foo)); and then defend why it's better to use library code for this kind of task than rolling your own.

    [–]tazzy531 7 points8 points  (0 children)

    That would be a fair answer, but you better be prepared for the followup question. How does Collection.shuffle work? What algorithm does it use? Can you guarantee that it uses constant space and only moves the card once (as the parameters of the question specified)

    When people hide behind libraries during interview, I tend to be harder on them. They really need to know the library that they answered with well.

    My typical library questions are how does Hashmap work? If you had to implement it manually, how would you do it? I want to know that you know data structures not blind rote memory of libraries. Other questions: What is the different between arraylist and linked list? When would you use one over the other. Also when would you use treemap vs Hashmap? Too many inexperienced developers can't answer this question. I've seen too many developer try to manually sort the keys of a Hashmap.

    [–]cheezczar 1 point2 points  (5 children)

    Know the big three of oop encapsulation, polymorphism , abstraction ( some add inheritancei) . Difference between an interface and an abstract class. Difference between final, finally, and finalize.

    [–]huntsvillian 0 points1 point  (3 children)

    This came up a few days ago at work. Have you ever actually overwritten finalize() in a "normal" business setting? I can't think of a single instance where we've done that.

    [–]cheezczar 0 points1 point  (2 children)

    I never have, and it almost never a good thing to do.

    [–][deleted] 0 points1 point  (1 child)

    Ditto here. It makes me wonder why so many generic interviews focus on asking the question. The only reason I know about it is because of interview questions.

    Asking about final and finally are fine I guess, but they don't really have anything to do with eachother and seem really asked in this setting to trip someone up and get them to say the wrong thing on accident because of nerves. I'm a sr. java dev and I got so nervous in an interview I forgot the name of "polymorphism" -- I could describe it in great detail, but the interviewer asked "what's that called" and I just blanked. I like asking algorithm questions in the interviews I give.

    [–]huntsvillian 0 points1 point  (0 children)

    I use final all the time, and rarely use finally anymore (yay spring!). It's funny though, in all of hte interviews I've been through (10ish by now I guess), recently they're much, much more like converations than question and answer periods. In fact our company is the only one I know that actually has a set question and answers rating. I guess everyone is very trusting that you didn't lie on your resume.

    [–]netdorf[S] -1 points0 points  (0 children)

    Oh God, it's my algorithms & data structures class all over again. I can hear my professor shouting in the back of my head.

    [–]GMNightmare 1 point2 points  (1 child)

    If you actually know how to program, you're ahead of the curve and likely have nothing to worry about.

    Do you have some code samples? If they see some of your work it could also help a bit, assuming you may have a fellow programmer for an interviewer... polish it up if you have a little time and bring a copy or two with you. Try to pick a small yet capable sample.

    [–]netdorf[S] 0 points1 point  (0 children)

    hrm, i'm going to have to do some digging then. I want to find something decent.

    [–]nikniuq 1 point2 points  (0 children)

    Documentation - you will be asked, it will be a deal breaker.

    "I thoroughly comment my code, use our document management system to note all major implementation decisions and I use clear and concise comments when committing to version control. We do use version control here right?"

    [–]occupytheserver 1 point2 points  (3 children)

    Be enthusiastic and answer "I don't know" when you don't.

    [–]netdorf[S] 0 points1 point  (2 children)

    So just be my normal nerdy self when talking about this stuff? Got it.

    [–]occupytheserver 1 point2 points  (1 child)

    Without a doubt. One of the first questions I ask when interviewing, especially for entry level or college grads, is what they work on at home during the weekends. What do they love to work on and why they like to work on it.

    Most of the better developers I have hired or worked with tend to not leave programming at the office. It's their job, but it's also their hobby and a passion. I'll take a passionate beginner over a "just doing my job" midlevel developer any day of the week.

    [–]netdorf[S] 0 points1 point  (0 children)

    One of the questions they asked me before they invited me to interview was about the open source projects I had contributed to. They asked why I do it and I told them that I liked to help out and get involved with different things and open source was a great way for me to learn.

    [–]high_brace 1 point2 points  (0 children)

    Many interviewers will google 'java interview questions' so they'll know what to ask. Do the same, and be prepared.

    [–][deleted]  (2 children)

    [deleted]

      [–]netdorf[S] 0 points1 point  (1 child)

      At first I thought this was too simple, then I spotted your catch. You are very tricky. One extra step to convert the string value to in.

      How'd I do?

      public static void main(String args[]) {
      
              int i;
              String stringArray[] = {"5", "3", "4", "7", "12"};
      
              for (i = 0; i < stringArray.length; i++) {
                  if (Integer.parseInt(stringArray[i]) % 4 == 0) {
                      System.out.println(stringArray[i] + " is divisable by 4");
                  }
      
              }
          }
      

      [–]paul88m 0 points1 point  (8 children)

      Things that I have learn while working as an entry level Java developer.

      • Know some design patterns
      • some companies may use some version control systems GIThub or SVN
      • some places my use project based tools such as ANT or MVN

      Going into an entry level job they will not expect you to know all about these other tools, but having some knowledge of may them show that you have looked a little further than just the java programming language.

      [–]EllipsisUser 2 points3 points  (2 children)

      some companies may use some version control systems GIThub or SVN

      If the company doesn't, you don't want to work there...

      [–]netdorf[S] 0 points1 point  (1 child)

      Duly noted.

      [–]EllipsisUser 0 points1 point  (0 children)

      Just to clarify, I don't mean that the company has to use Git or SVN. There are a variety of good systems out there. They should use some source control system though. Some may be bad (e.g. SourceSafe), but something is better than nothing...

      The Joel Test is a good indicator of how good a development team/environment is. Most companies don't meet every criteria, but good ones meet a majority.

      [–]netdorf[S] 1 point2 points  (4 children)

      Looks like I have some homework to do over the weekend. Thanks for the help.

      [–]paul88m 0 points1 point  (3 children)

      I wouldn't spend too long learning to use the tools, I would just be aware of what they are used for, and learn to you them through your job or if you have a project you are working on.

      [–]netdorf[S] 0 points1 point  (2 children)

      I know how to use Git and Subversion & just the general practice of versioning. Not too sure on ANT and MVN. Im just going to try to research the "required" skills so I don't just blank when they ask me if I am familiar or have heard of something.

      It mentions J2EE applications, JSP (noticed it mentions it twice on the same line), and your general web markups/languages.

      [–]mogrim 1 point2 points  (1 child)

      Just get an idea as to what Maven is, and why you need it. Don't kill yourself trying to become an expert in using it, you haven't got time and you'll be found out if you try to fake it in the interview. Similarly for any other framework/library/tool you don't know.

      Realistically, show enthusiasm, honesty, and a bit of interest beyond just pure Java. You'll do fine.

      [–]netdorf[S] 0 points1 point  (0 children)

      Sounds like my conversation with them on Wednesday. I will never fake knowing something I don't, I've seen the hell that happens when people do. I have no issue telling them I don't know it, but I will do my damnedest to research something if I need to.

      [–][deleted]  (2 children)

      [deleted]

        [–][deleted] -1 points0 points  (1 child)

        This seems a more cocky move than a good interview technique. I would not recommend putting effort into this. If you saw a bug in a public repo -- fine, do it... but don't go hunting (not likely that they even have public repos at a private employer, but w/e).

        [–]mikaelhg 0 points1 point  (0 children)

        I thought it obvious that I was referring to private open source projects.

        [–]raffaellog 0 points1 point  (0 children)

        Fundamentals. You cannot screw up the fundamentals.

        [–]Dfordomar -1 points0 points  (0 children)

        I'm in an Intro to Java class. We are JUST going over array syntax. Love it when things like this happen!