0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JAVA学習履歴 インタフェース

Last updated at Posted at 2017-06-30

最近サボっていたJAVA学習を再開
やらなきゃいけないことをやっていないとそれがストレスになるみたい。
じゃあ集中しろよって話…

インタフェース

直訳すれば境界面、接点だとからしい。
物事と物事の境界にあって、それをつないでくれるものというイメージなのかな。

プログラム的にいえば
継承関係のないクラスに機能を提供する仕組みであって、
クラスとの違いは定数と抽象メソッドしかメンバになれない事が異なる点だそう。

インタフェースもそのままじゃ使えなくて
クラス生成時に
implements
で機能を実装させてあげなくちゃいけない。

定義

   処理の中身~~~~~
   ※定数、メソッドしかメンバになれない
}```


## 実装
```class A implements インタフェース名 {
   public(これつけてオーバーライド) ~~ () {
   }
}```

ちなみにimplementsはいくつでも実装可能。
続けて書くときは「,」をつけるのを忘れずに。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?