Method Overloading Example 2

 

class Sum {
int checkSum(int a, int b) {
return a + b;
}

int checkSum(int a, double b) {
return (int) (a + b); // typecasting
// assign a value of one primitive data type to another type.
}

int checkSum(double a, int b) {
return (int) (a + b);
}

int checkSum(double a, double b) {
return (int) (a + b);
}
}

public class TestMethodOverLoading2 {
public static void main(String args[]) {
Sum s = new Sum();

System.out.println(s.checkSum(1, 2));
System.out.println(s.checkSum(1, 2.2));
System.out.println(s.checkSum(4.3, 2));
System.out.println(s.checkSum(5.5, 12.7));

}
}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...