1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| class A_JBT3202 { int x, y; float z;
double add(double f1, double f2) { return f1 + f2; }
int add(int i1, int i2) { return i1 + i2; } }
public class JBT3202 { public static void main(String args[]) { A_JBT3202 a = new A_JBT3202(); System.out.println("浮点数相加=" + a.add(1.1, 2.2)); System.out.println("整数相加=" + a.add(1, 2)); } }
|