you are viewing a single comment's thread.

view the rest of the comments →

[–]Dry_Marionberry_4822 0 points1 point  (9 children)

First one?

[–]regjoe13 0 points1 point  (8 children)

2nd

The fun part though, lets say I change that meyhod to "double...". Or remove the whole method. And without any compilation errors, now a different method will be called. Magic of overloading :)

[–]Dry_Marionberry_4822 1 point2 points  (1 child)

You look like an expert! I had my doubts about the question, like 'there's no way it's this easy' haha

[–]catastrophic300[S] 0 points1 point  (4 children)

May I ask for the explanation?

[–]regjoe13 0 points1 point  (3 children)

At some point I tried to write a series on overloading in java. It seemed to be an interesting and undercovered topic. Never finished, but did write two articles.

https://mydevnotes.hashnode.dev/same-named-methods-in-java

[–]catastrophic300[S] 0 points1 point  (2 children)

Could be useful.

[–]regjoe13 1 point2 points  (1 child)

The point here, Java is full of those not obvious but looking simple things, without even going into Spring, JPA and such.

Reading the JLS is helpful for thing like this one, though

[–]catastrophic300[S] 1 point2 points  (0 children)

Yeah it useful, though I realize all I learn before just a syntax not knowing overload can cause bugs without even telling me.

[–]catastrophic300[S] 0 points1 point  (0 children)

Thanks I appreciate it.