Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Siddesh Gannu](https://uploads.teamtreehouse.com/production/profile-photos/5635592/micro_matrix.jpg)
Siddesh Gannu
3,565 PointsMethod overloading with same parameters in different order
I am curious that if I have 2 methods like:
public void name(String s, int a, double d){ }
public void name(double d, String s, int a) { }
Are these 2 methods legal? Is this allowed in Java? I'm mainly just curious. What if I wanted to write different code in each? would I need to then create 3 separate methods for this? Thanks! :)
1 Answer
![Jeff Wilton](https://secure.gravatar.com/avatar/326a9aaae71ee01c926b6ab3292c3c8a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeff Wilton
16,646 PointsYes, it is completely legal to have the same parameters in different order when overloading in Java.
Siddesh Gannu
3,565 PointsSiddesh Gannu
3,565 PointsThank you!
Ole Vølund Skov Mortensen
27,841 PointsOle Vølund Skov Mortensen
27,841 PointsAmazing. I see it as cascading method calls like CSS fx; so if I call 'Fill' with no arguments it'll act normal, if I add one argument it can seamlessly cascade to the method with that one argument handling. beautiful.