First time posting here sorry about the format.
public static void main(String args[]) {
float x, y, z;
System.out.println("Enter two integers to calculate their sum ");
Scanner in = new Scanner(System.in);
x = in.nextFloat();
y = in.nextFloat();
z = x + y;
System.out.println("Sum of entered integers = "+z);
}
public static void main1(String args[]) {
int x, y, z;
System.out.println("Enter two integers to calculate their sum ");
Scanner in = new Scanner(System.in);
x = in.nextInt();
y = in.nextInt();
z = x + y;
System.out.println("Sum of entered integers = "+z);
}
}
I need help method overloading on letting my program add numbers with int and floating point for example 4 and 5 = 9
4.0 and 5.0 = 9.0
but as of now my output is only giving me floating point value even if I just input number with int values.