---
title: "接口的的作用（注意第13行）"
author: "tobemoved"
date: "2008-07-09T09:45:49Z"
tags: []
slug: "13"
draft: false
lastmod: "2008-07-09T09:45:49Z"
id: 212947
url: "https://tobemoved.iteye.com/blog/212947"
---

```
interface B {
    String getS();
}
class A2 implements B {
       public String getS() {
           return "A2";
       }
}
public class A implements B {
    public String getS() {
           return "A";
    }
    static void show(B b) {
        System.out.println( b.getS());
    }
    public static void main(String[] args) {
        A2 a2 = new A2();
        A a = new A();
        show(a);
        show(a2);
    }
}
```