All language subtitles for 016 Interface_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

An interface defines method that a class needs to implement.

If a class implements an interface, it must override all of the methods inside the interface.

In this lesson, one of your classes is going to implement an interface.

An interface is a contract, and the contract defines methods that a class needs to implement.

Use an interface to define behavior that's required from a class, because if a class implements an

interface, it must override all of the methods inside the interface.

You can define an interface the way you would define a class public interface, followed by the interface

name.

And inside the interface, you can define method signatures, a class that implements this interface

must override every method inside of its.

So looking back at the requirements, we see that pense are eligible for 50 percent discounts, but

shirts are not.

But what I want to do is force the pants class to implement this behavior.

So I'll define an interface, create a new file, discounted Java.

And inside this kind of job, Java make this an interface.

And we're going to force every class and implement this interface to override a public void method called

discount.

And now inside Penstock Java, we can say that the pants class implements the discount interface.

When a class implements an interface, it's basically signing a contract that it's going to override

all of the methods inside the interface.

And here we have to honor the contract to override discount.

And we're going to offer a 50 percent discount by saying superdog set price.

Superdog get price divided by two.

And now the air is gone.

So back in Maine, we can call Penn student discount.

Put a breakpoint, launched the debugger.

And the price of the object went down by 50 percent.

Now, what's really interesting is that interfaces allow for polymorphism.

Because pants are discounted so we can declare the object as type discounted.

Keep this in mind for your next quiz.

An interface is a contract.

It defines methods that a class needs to implement.

When a class implements an interface, it signs the contract, therefore the class must override all

of the methods inside the interface.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.