摘要:
学习内容 1、定义一个基类Base,有两个公有成员函数fn1(),fn2(),私有派生出Derived类,如何通过Derived类的对象调用基类的函数fn1() 1 //基类: 2 public class Base { 3 public void fn1() { 4 System.out.prin 阅读全文
摘要:
学习内容 1、定义一个基类Shape,在此基础上派生出Rectangle和Circle,二者都有getArea()函数计算对象的面积。使用Rectangle类创建一个派生类Square。 1 //Shape类: 2 public abstract class Shape { 3 public abs 阅读全文
摘要:
学习内容 整数排序 编写函数重载,分别将两个整数升序排列后输出、三个整数升序排列后输出、四个整数升序排列后输出 import java.util.Scanner; public class Study { public static void sort(int a[], int n) { int t 阅读全文