Hi Friends few days back I went for an interview and the interviewer asked me that u r a SCJP. I proudly said Yes. He asked me can you tell me For which purpose Java came in the market. I said for platform independency., He said it was already there what is the new feature in Java ?, I said byte code generation. but he was not satisfied so any body can tell me What is that feature of Java ? for which it is/(was) so popular. -----Sameer Jamal
it Might be the case that he was asking a GK question abt java...java was being developed for portable computing devices but then the internet came along and they changed the very conceptual idea that was behind its inception and introduced technologies like Applets etc and made the jump on to internet. but thats my guess...
It's a subjective question obviously, but one good way to respond is to say that Java increases programmer productivity, and that it does this by eliminating many of the common sources of bugs and bad coding that exist in languages such as C++. If they want to know why programmer productivity is important, the answer is because programmers cost a lot more than hardware.
All: Ah yes...the typical "incompetant interviewer interview." The interviewer (Mr. Bozo) decides to ask you why was Java created? He is not satisifed with "Platform Independence". I would delve into a brief 30 seconds discussion of Java history - see if you can shake off Mr. Bozo. But, let's say he is not satisifed with the "history of Java" and Bill Gosling at Sun Microsystems. Fine, now is your chance to throw one of your stories at him. If you have been following JavaRanch for the past 4 months now - I mentioned that you need to have three or four stories in your aresenal BEFORE you go to the interview. ----- You can answer this question in one of two ways: - Method #1: Do a direct Java to C++ comparision - and pray that you hit the comparison Mr. Bozo was looking for. This should work - but it's not a home run. You could go to the board and do a comparison - but I want to save that for a later question - and you could get into trouble if he asks for code samples. Save your code samples for stuff you really know about - like Threads / Event Handling / Access Modifiers. Also, you have probably been thinking (like me) about Java the past 4 months - and haven't looked at a piece of C++ code in all this time. So you don't want to have to write C++ code on the board if you aren't ready. After all, this is a Java interview. - Method #2: Tell a story about how you worked with C++ - the problems you encountered - how it delayed the project. Warning!!! Don't turn this into a bitch & complain session. Now, compare and contrast C++ and Java. Memory leaks are a classic. Readability of code - no pointers (been done before but you need to think fast and this is what you think of first). No multiple inheritance. Again, not a grand slam - but it's better than method #1. ----- So, why do I call the interviewer Mr.Bozo - Because your original answer should have sufficed. Who the hell cares about the history of Java. What does this tell the interviewer - not a damned thing. It's like telling him that you are the Grand Wizard of Dungeons & Dragons. BTW/ I think someone sent me a resume' with that listed as one of their hobbies. It tells him you read a book for all of 30 seconds. Well, I put the seat down after I peed - big freaking deal. His question doesn't even really "put you on the hot seat". About all he gets to see - is if you "put your foot in your mouth" by going on a 10 minute diatribe. ------ The all-time classic "hot-seat" question would play out as: Question #1: Tell me about a project you have worked on. Question #2: Tell me about the strenghts / weaknesses you encountered in this project. Answer #1 / #2: You pull out one of your stories - and go with that. You score a home run as we say. Question #3: Go to the board and outline the project. Answer #3: This is the hotseat question that separates the b.s.'s from those who have their act together. And of course, you are a good little boy who would never dream of exagerrating their way through an interview. First, you need to qualify his question. Meaning, what would he like to see. The worst thing to do is write a beautiful diagram on the board and have the interviewer say "you haven't showed me a damned thing" <--- straight from the Martin Yate text. So like a good Java programmer - after qualification of the question - you outline the project as best you can to the interviewers specifications. Not UML - but an outline.
There will be follow up questions to your anwer #3. But if you did your homework - you can really kick some serious rear-end here. Lot's of times if you can get through Answer #3 - you have made it to Round #2 of the interview game, which is either another tech interview - or an offer. Note: I have only had the hot seat question come up one time - and that was at an on-campus Java interview. Yes, it through me for a loop - but I wadlled on through it. Nope, did not get asked to a second interview - but I did learn from the experience. John Coxey (email@example.com)
Evansville, Indiana, USA
Joined: Feb 16, 2001
Hello Friends Thanx for ur Guidance but you see actually I can not tell the stories there in Interview, Interviewer always wants a brief answer. Another question which Mr Bozo asked me about Java was why are pointer not there in Java ?. could you please tell me answer to this question Sameer Jamal
Joined: Oct 24, 2000
Sameer Jamal: If the interviewer asks you why there are no pointers in Java. ---- You can answer this by saying that it makes the code more readable - easier to maintain. At 2AM I don't want to have to relearn pointers and reference variables - I want to get the program fixed and hit the sack. It may have been an issue with platform independence - why you can't use java to perform system level functions (device drivers for instance) - unless you go with native code. And the platform independence issue may have something to do with why Java has no pointers. At this point - I would let the interviewer explain the anwer - at the same time I would be taking mental notes. When I got back to my car - I would write everything he said down and do some research. In this manner, you prepare yourself in case the situation comes up with another interviewer/etc. -- Another approach to the Java and pointers question:
You could also answer - Java does have pointers. (This may have been when the interviewer was looking for). Example: Apple a = new Apple(); Apple b = a; Note that b now "points" to a. ---- If you have your act together - you could write out a linked list. In doing so, you will hit a number of topics - and possible hit a run or a slam. 1. This shows that you understand the pointer question. 2. That you understand data structures. 3. That you understand encapsulation (data hiding). 4. That you understand inheritance (if you wrote an abstract class with just the method names - and then extended the abstract class). 5. That you understand garbage collection - explain when items get garbage collected. 6. That you understance exceptions (if you went this far in your code). 7. That you can communicate clearly and effectively. ---- Would it not be lovely if you went to the board and wrote out a linked list - and the interviewer said "What does that show me?" And instead of freakin out - you listed items #1 - items #7 on the board. ----- 90% of the time - this is all you are going to have to do - you've done your job. Pat yourself on the back. More than likely you will be invited to round #2 or an offer will be made. 10% of the time - they guy is a prick - and will continue to be so --- and in a nasty way. Now you have separated out a company that you don't want to work for. Of course, you remain polite, courteous , and professional at all times - cuz you never know if they are just playing "mind games" with you. Personally, I don't like "mind games" and probably would turn down the offer. John Coxey (firstname.lastname@example.org) [This message has been edited by John Coxey (edited April 28, 2001).]
About the pointers in Java question... I would answer: "Of course there are pointers in Java! How else are you going to reference the fields and methods in an object? And why is there a NullPointerException in Java if there are no pointers? "What Java does not have is pointer arithmetic! You cannot add, multiply, subtract anything from reference variables (as C++ pointers are called in Java). "The reason is that pointer arithmetic is one of the main sources of execution errors in C++ and the designers of Java wanted to avoid that."
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Joined: Feb 16, 2001
I mean to say the function of pointers in c++ is taken by which thing in Java ?
Just a question related to what we had here and often asked in interviews: in C --> pass by value in C++ --> pass by value and reference. In java? I think the correct answer is pass by value (basically copy of a reference?) what do u guys think? karthik.
Joined: Jan 30, 2000
In Java all parameters are passed by VALUE. That is, a COPY of the value is made and given to the method. This value could be the copy of an integer or the copy of a reference value (pointer) to an object. In all cases, they are copies. Therefore, passed by value.