• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

few basic questions

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder if there is a concept like Static Polymorphism. Technically, isn't polymorphism supposed to be runtime?
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


Thank you!
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic