FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Method Overloading Tasks
NewsMachine Learning

Method Overloading Tasks

via Dev.toKesavarthini3h ago

Method Overloading Tricky Questions : class Test { void show ( int a ) { } void show ( long a ) { } public static void main ( String [] args ) { Test t = new Test (); t . show ( 10 ); } } ANSWER: show(int a) 10 is int → exact match is preferred over widening (int → long) class Test { void show ( Integer a ) { } void show ( int a ) { } public static void main ( String [] args ) { Test t = new Test (); t . show ( 10 ); } } ANSWER: show(int a) Exact primitive match is preferred over autoboxing (int → Integer) class Test { void show ( int a , float b ) { } void show ( float a , int b ) { } public static void main ( String [] args ) { Test t = new Test (); t . show ( 10 , 10 ); } } ANSWER: Compile-time error (Ambiguous) Both require one widening conversion → compiler confused class Test { void show ( int ... a ) { } void show ( int a ) { } public static void main ( String [] args ) { Test t = new Test (); t . show ( 10 ); } } ANSWER: show(int a) Normal method > varargs class Test { void sho

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles

The data from 400,000 developers exposes the grind myth — and shows what actually separates good…
News

The data from 400,000 developers exposes the grind myth — and shows what actually separates good…

Medium Programming • 29m ago

News

Why your next mobile app is probably headless

Lobsters • 37m ago

Major SteamOS update adds support for Steam Machine, even more third-party hardware
News

Major SteamOS update adds support for Steam Machine, even more third-party hardware

Ars Technica • 47m ago

News

Is Composer 2 in Cursor Any Good?

Medium Programming • 48m ago

Unreal Engine Hotkeys You Should Already Be Using!
News

Unreal Engine Hotkeys You Should Already Be Using!

Medium Programming • 54m ago

Discover More Articles