I am trying to formulate the rules that are being used in the scenarios below. Please explain why I am getting 2 different outputs.
Scenario 1 output: I am an object.
class Test {
public static void main (String[] args) {
Test t = new Test();
byte b_var = 10;
t.do_the_test(b_var);
}
public void do_the_test(Character c) {
System.out.println("I am a character.");
}
public void do_the_test(Integer i) {
System.out.println("I am an integer.");
}
public void do_the_test(Object obj) {
System.out.println("I am an object.");
}
}
Scenario 2 output: I am an integer.
class Test {
public static void main (String[] args) {
Test t = new Test();
byte b_var = 10;
t.do_the_test(b_var);
}
public void do_the_test(char c) {
System.out.println("I am a character.");
}
public void do_the_test(int i) {
System.out.println("I am an integer.");
}
public void do_the_test(Object obj) {
System.out.println("I am an object.");
}
}