How to revise java? [closed]
Ok so this isn't 100% programming question, for which I'm really sorry, but still this is the best place I know to ask it.
In ~2weeks time I'll have a job interview, first they'll make me take a test from Java and I was wondering what's the best way to prepare for it? I bet it will be something similar to SCJP (but probably much easier), are there any (short) books, tutorials that are worth reading? I did order the SCJP book by Sierra/Bates but I won't be able to read it before the test.
Don't get me wrong I do have experience with Java etc. but I really want to get the job so I want to go there well prepared.
Also marry Xmas to everyone, no matter what religion you are.
Don't get me wrong I do have experience with Java etc. but I really want to get the job so I want to go there well prepared.
If you have enough experience don't worry about the test. Don't try to impress your next boss with an awesome test that does not reflect your current knowledge. Read Joel's posts about interviewing:
The second worst kind of interviewer is the Quiz Show Interviewer. This is the kind of person who thinks that smart means “knows a lot of facts.” They just ask a bunch of trivia questions about programming and give points for correct answers. Just for fun, here is the worst interview question on Earth: “What’s the difference between varchar and varchar2 in Oracle 8i?” This is a terrible question. There is no possible, imaginable correlation between people that know that particular piece of trivia and people that you want to hire. Who cares what the difference is? You can find out online in about fifteen seconds! Remember, smart does not mean “knows the answer to trivia questions.” Anyway, software teams want to hire people with aptitude, not a particular skill set. Any skill set that people can bring to the job will be technologically obsolete in a couple of years, anyway, so it’s better to hire people that are going to be able to learn any new technology rather than people who happen to know how to make JDBC talk to a MySQL database right this minute.
quoted from "The Guerrilla Guide to Interviewing (version 3.0)" by Joel Spolsky
If you need to impress someone to get the job, may be that's not a good place to work...
I recommend you pick up Effective Java, 2nd Edition by Joshua Bloch and read it cover to cover. It details several "best practices" for Java and will have you walking into the interview knowing for example things like:
- when to use Static Factory Methods
- when to use the Builder Pattern
- what a Singleton is and how to enforce it
- how to prevent instantiation of a class
- why to avoid finalizers
- the general contract for overriding equals and hashcode
- to use accessor methods instead of public fields
- to prefer lists to arrays
- to favor generic types
- to use enums instead of int constants
- to return empty collections or arrays instead of null
- to prefer for-each loops over traditional for loops
- to avoid float and double if exact values are needed
- beware of performance loss when doing string concatenation
- refer to objects by their interfaces
Not to mention the other 40 or so topics that I can't remember off the top of my head. If you're able to talk about these topics and demonstrate an understanding, then there's no reason you shouldn't be in the running for the position since learning this material will already put you in the top 10 percentile of Java developers.
I have a little book with "Exam Cram" in its title. The emphasis is on "little;" you can read through it in a single evening. It describes in prose all the important features of Java, it contains tables of quick facts that will be essential, and it covers, briefly, all of the SCJP exam.
For the less than eidetic, it gives hints on how to write yourself a crib sheet from memory once the test starts (meaning you can carry a bit of what you need to know in short-term memory). There are also some tips on pitfalls and such. Finally, and perhaps most importantly, there is at least one practice exam in it (haven't looked at it in a while) and a bunch of drill questions.
Alas, from what I see at Amazon, the book I recommended only covers Java 2: http://www.amazon.com/Java-Exam-Cram-310-025/dp/1576102912 Still, there are bound to be similar, more timely books.
This one: http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060/ref=sr_1_1?ie=UTF8&s=books&qid=1261601183&sr=1-1 by Kathy Sierra is similar and about Java 6.
Some people would (and in fact did) recommend buying a general purpose Java book. Ideally, all you should have to do is learn "all of Java" and then you'd be ready for the exam. But this is not a winning strategy!
related anecdote
The first time I took my driver's test with the DMV, I had a long wait and quickly skimmed through a little info booklet they provided. I easily scored 100.
I later had to take the test again. Knowing the test was laughably easy, I spurned the booklet and failed the theoretical test. The booklet didn't contain anything I didn't already know: But being by the same people who administer the test, it contained the same wording, it had similar situations from the test, it emphasized similar topics and situations. In a few minutes, it could easily make the difference between passing and failing.
Conclusion
Same approach with these "prepare for test XXX" books. It's a racket, but the special-purpose prep books work better at preparing you for the test than general knowledge (or general knowledge books) do.
May be you should read Eckel's Thinking in Java. In this book many specific java features are considered.
I would rather prepare my self to explain what I already know about java and how much I would like to work for that company.
While the programming knowledge is essential, I don't think you can improve much further in two weeks.
Better would be for you to prepare to answer, why do you want to work there, why should they hire you. etc.
My recommendation is HeadFirst Java to brush up on anything you may have some issues on. The SCJP is something that they may make you take upon hiring within 6 months for example, however I have never heard of a company making someone take a proctored test at an interview. Hope this helps.
Write something small but useful in Java, in whatever environment they're going to be using (applets, JSP, desktop...). That way you won't freeze trying to remember how to do e.g. console output.
If possible, show them some Java code you've obviously written and that you're proud of.
Brush up or learn the following :
- Simple concepts e.g. static keyword, importance of equals and hashCode, etc.
- How generics in java work?
- How threading works, deadlock, race conditions, etc.
- How java deals with memory. Can garbage collection be enforced?
- Basics of OOP.
- Basics of String, StringBuffer, StringBuilder, RuntimeException, etc.
- Design patterns, e.g. singleton, visitor, etc.
If you want to know the language well then The Really Big Index will be invaluable. It's a huge list and you'd struggle to read it straight though but for a reference it's fantastic. Read it along with a set book like Thinking in Java or the SCJP book you've already ordered and you'll be absolutely fine.
精彩评论