hello, I am begginer in JAva. I had been to one interview. They asked me following questions. It will be very useful if i get some clarification about these.
1. what is the difference between overloading and overrideing. where overriding is used? overloading is same method name with different no. of orguments, return type and orgument data type. overriding--no idea. 2. what is the use of "static" infront of a class, a method and a variable? no idea at all. (variables, can be accessed without creating a handle for it) 3. Can main method overloaded or overriden? Can't be overloaded as it accepts only String type of comman lind orguments. no idea about overriding. 4.what is the difference between static and final?--final is a constant. whose value can't be changed. No idea about difference 5. what is the difference between static polymorphism and dynamic polymorphism, give examples.--no idea 6. what is the difference between extends and implements. I think extends is for single inheritance where as implements is for multiple inheritance.
I'll suggest you to go through some book like Headfirst or Thinking in Java before appearing for any more interviews. All the questions are quite elementary and can easily be found in a beginner book. So, go through a book first and then if you have any doubts, which you will, post it here. In that way, you will learn better.
I just reply what I know. If there are any wrong points , please tell me.
1. Overload : means that methods with different type of parameters.Take "valueOf" as example: there are many versions of method valueOf , such as valueOf(boolean b)、valueOf(int i)、valueOf(char c)...etc. According to the different type of arguments , calling corresponding methods. Override : means re-defined super class's methods. When you extends super class , you got some methods from it. But it is not agree with you at all. In this situation , you can "override" the method. For example:
Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.
It sounds like this was a good experience, because now you know some of the things you need to study! A good introductory book would help you a lot. I suggest Head First Java by Kathy Sierra and Bert Bates.
You can also download a free copy of Bruce Eckel's Thinking in Java (3rd edition) from the author's website -- although you should note that this edition does not cover any new features of Java 5.0.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org