Skip to content

Instantly share code, notes, and snippets.

@hydai
Created November 11, 2013 16:46
Show Gist options
  • Save hydai/7416285 to your computer and use it in GitHub Desktop.
Save hydai/7416285 to your computer and use it in GitHub Desktop.
modify the code so that it can compile correctly.
class Test {
public static void main (String[] args) {
Test t = new Test();
/*
System.out.println(t.xmethod(7));
// Error: t.xmethod is void type, so we cannot put it in println
*/
t.xmethod(7);
}
public void xmethod(int t) {
System.out.println("int");
}
public void xmethod(long t) {
System.out.println("long");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment