First, write a class Chongzai, which has 3 overloaded methods in void print (), and second,
Then write a main class to test the functionality of the Chongzai class.
public class Chongzai1 {//First, write a class Chongzai that has 3 overloaded methods in void print (), and second,//write a main class to test the functionality of the Chongzai class. int a,b,c;public int Geta () {return A;} public void SetA (int a) {this.a = A;} public int Getb () {return B;} public void Setb (int b) {this.b = b;} public int GetC () {return C;} public void setc (int c) {this.c = C;} Public double Add (double a,double b) {return (a+b);} Public double Add (double a,double b,double c) {return (add (A, b) +c);} Public double Ji (double a,double b) {return a*b;} Public double Ji (double a,double b,double c) {return Ji (b) *c;} Public double H (double a,double b,double c) {return Ji (b) +c;} public static void Main (String [] args) { Chongzai1 c=new Chongzai1 (); System.out.println (C.add (3, 4)); System.out.println (C.add (3, 4, 5)); System.out.println (C.ji (3, 4)); System.out.println (C.ji (3, 4, 5)); System.out.println (C.h (3, 4, 5));} }
Java Basics _ Classes and objects. -5