• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Could some one give me practise questions on method overloading

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could some one please give me about 15-20 practical questions on method overloading.I have to make my cousine the concept clear by making him do more sample practise problem.Any help would be highly appreciated
 
Ranch Hand
Posts: 231
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It will be great if you specify what do you understand by method overloading when you say "method overloading".
 
midhun raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In java method overloading means functions with same function signature but different return type and differ in the amount of there argument...
I need questions like this for example...


Write a program on function overloading with aera() of cube,cuboid,sphere etc...

please share some more example questions of this sort
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I will write some code for you.



Constructor of class example is overloaded. Now, draw a conclusion by yourself
 
Rajdeep Biswas
Ranch Hand
Posts: 231
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

midhun raj wrote:In java method overloading means functions with same function signature but different return type and differ in the amount of there argument...


Yes, you are correct. Just think overloading as a concept known only to us. The compiler and JVM thinks of them as totally different methods (they consider only the whole prototype to judge similarity of methods), and for us, just their names are common.
So we use overloading when we feel that we are performing similar tasks but for different arguments or any other parameters.

For example, take an addition method.



So depending upon your thought-space, you can construct as many overloaded methods you want!
Hope that helps.
 
Marshal
Posts: 76861
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the parameter types are part of the signature, so overloaded methods must have different signatures. They have the same method identifier.
 
Campbell Ritchie
Marshal
Posts: 76861
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And overloaded methods might have the same return type
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic