- <p>package com.heima.demo;
- public class Test_demo {
- public static void main(String[] args) {
- HeiMaStudent hms = new HeiMaStudent(new Student());
- hms.code();
- }
- }
- interface Coder {
- public void code();
- }
- class Student implements Coder {
- @Override
- public void code() {
- System.out.println("javase");
- System.out.println("javaweb");
- }
-
- }
- class HeiMaStudent implements Coder {
- private Student s;
-
- public HeiMaStudent (Student s) {
- this.s = s;
- }
- @Override
- public void code() {
- s.code();
- System.out.println("大数据");
- System.out.println("javaee");
- System.out.println("....");
- }
-
- }</p><p>尤其是后面的私有学生类,还有下面的HeiMaStudent方法里this.s = s;到底是什么意思,代表什么,完全不懂,请指教</p>
复制代码
|
|