This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes few basic questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "few basic questions" Watch "few basic questions" New topic
Author

few basic questions

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
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.

hope to get some help to face next interview.

Regards,


With Regards,
Anu
Aum Tao
Ranch Hand

Joined: Feb 14, 2006
Posts: 210
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.


SCJP 1.4 85%
Aum Tao
Ranch Hand

Joined: Feb 14, 2006
Posts: 210
I wonder if there is a concept like Static Polymorphism. Technically, isn't polymorphism supposed to be runtime?
Chia-you Chai
Greenhorn

Joined: Jul 22, 2006
Posts: 13
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:

[ July 22, 2006: Message edited by: kevingo ]
Chia-you Chai
Greenhorn

Joined: Jul 22, 2006
Posts: 13
2. What is static? Let me take "Math" class for example.
Some methods or data is useful and we want to call them easily. What should we do? For example:

See? I do not new a Math object to call the method "abs(int i)".
Such as : It is wrong!
Because the declaration of abs() is

When a method or variable declare as static , you must use className.methodName or className.variableName to call them. The static members are owned by class , not object.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"kevingo,"

Welcome to JavaRanch!

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.

You can edit your display name here.

Thank you for your prompt attention, and enjoy the ranch!

-Marc


"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
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Ashvini,

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.
Chia-you Chai
Greenhorn

Joined: Jul 22, 2006
Posts: 13
Dear "Marc Weber" , I have known that naming policy after I post the reply, now I have change my name. Thank you for your attention.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Chia-you Chai:
...now I have change my name...

Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: few basic questions