摘要: 1 abstract class MotorVehicles { 2 abstract void brake(); 3 } 4 interface MoneyFare { 5 void charge(); 6 } 7 interface ControlTemperature { 8 void con 阅读全文
posted @ 2020-12-17 13:48 李家宇 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 1 interface Advertisement { 2 public abstract void showAdvertisement(); 3 public abstract String getCorpName(); 4 } 5 class AdvertisementBoard { 6 pub 阅读全文
posted @ 2020-12-16 13:23 李家宇 阅读(97) 评论(2) 推荐(0) 编辑
摘要: 1 class School { 2 String name; 3 public class Student { 4 String name; 5 int age; 6 public Student(String schoolName,String studentName,int newAge) { 阅读全文
posted @ 2020-12-15 13:09 李家宇 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1 interface Animal { 2 public abstract void cry(); 3 public abstract String getAnimalName(); 4 } 5 class Simulator { 6 public void playSound(Animal an 阅读全文
posted @ 2020-12-14 13:35 李家宇 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 1 class A { 2 double f(double x,double y) { 3 return x+y; 4 } 5 static int g(int n) { 6 return n*n; 7 } 8 } 9 class B extends A { 10 double f(double x 阅读全文
posted @ 2020-12-13 11:01 李家宇 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 1 interface Achievement { 2 public abstract float average(); 3 } 4 class Person { 5 String name; 6 int age; 7 public Person(String newName,int newAge) 阅读全文
posted @ 2020-12-13 10:54 李家宇 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1 abstract class SIM { 2 public abstract void setNumber(String n); 3 public abstract String giveNumber(); 4 public abstract String giveCorpName(); 5 } 阅读全文
posted @ 2020-12-13 09:20 李家宇 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 abstract class Shape { 2 public abstract float area(); 3 public abstract void printArea(); 4 } 5 class Rectangle extends Shape { 6 int width; 7 int 阅读全文
posted @ 2020-12-12 10:11 李家宇 阅读(116) 评论(0) 推荐(1) 编辑
摘要: 1 class PersonA { 2 private String name; 3 public void setName(String newName) { 4 name=newName; 5 } 6 public String getName(){ 7 return name; 8 } 9 } 阅读全文
posted @ 2020-12-11 09:13 李家宇 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test4_3_5 { 2 public static void main(String[] args) { 3 f(1,2); 4 f(-1,-2,-3,-4); //给参数传值时,实参的个数很灵活 5 f(9,7,6); 6 } 7 public static vo 阅读全文
posted @ 2020-12-10 20:08 李家宇 阅读(65) 评论(0) 推荐(0) 编辑