要实现Rational类的加减乘除,要实现其可比较性,要覆盖toString()方法,要实现不同数据类型的转换等. package chapter14; public class Rational extends Number implements Comparable { private long numerator=0; private long denominator=1; public Rational(){ this(0,1); } public Rational(long numer…
/** * * @author YZJ * @Description java中定义常量的最佳方法 */ public final class Contants{ /** * @Description 私有化构造方法 */ private Contants(){}; public static final int contants1 = 1<<1; public static final int contants2 = 1<<2; public static final int c…