Archive for May, 2012

Method Overloading Ambiguity Problem

While going through an article about method overriding in OOP, I stumbled upon an ambiguity problem in overriding.

Here is the java code I wrote to test it:

public class OverLoadingTest {

static void testOverload(int i,double d) {
System.out.println("testOverload 1: int, double");

static void testOverload(double d,int i) {
System.out.println("testOverload 2: double,int");

public static void main(String[] args) {

testOverload(2,3); // Compilation error:  The method testOverload(int, double) is ambiguous for the type OverLoadingTest

In the third call testOverload(2,3), there will be a compilation error, because:

First argument 2 is int, so java compiler will decide to call the method testOverload(int,double) because its first argument is int, so it is better match than .testOverload(double,int)

Second argument 3 is also int, so java compiler will decide to call the method testOverload(double,int) because its second argument is int, so it is better match than testOverload(int,double)

As compiler will not be able to decide the right overloaded version for call, compilation error occurs.

Happy Coding !

Leave a comment

Enable/Disable Speakers/Headphones in Windows 7

Today I accidentally disabled my Windows 7 laptop speakers. I was installing Skype and testing it with headphones. I was getting the voice from other side from the laptop speakers, not through headphones. So I went to Control Panel–> Sound and disabled the speakers. So now only headphones were enabled, so the voice started coming through headphones. But now how to enable the speakers back? Now in Control Panel–> Sound, I was not getting speakers anywhere, so there was no way to enable them. Then when I googled it and found this article.

The solution was simple. In Control Panel–> Sound, in Playlist tab, Right Click and check Show Disabled Devices. Then select the disabled device, speakers in this case, go to Properties and there you can enable them. Hope this helps.

Happy Listening !


enable speakers in windows 7