Interfete • Ce este o interfat˘a ? • Definirea unei ... - Profs.info.uaic.ro
Interfete • Ce este o interfat˘a ? • Definirea unei ... - Profs.info.uaic.ro
Interfete • Ce este o interfat˘a ? • Definirea unei ... - Profs.info.uaic.ro
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<st<strong>ro</strong>ng>Definirea</st<strong>ro</strong>ng> <st<strong>ro</strong>ng>unei</st<strong>ro</strong>ng> interfet¸e<br />
[public] interface NumeInterfata<br />
[extends SuperInterfata1, SuperInterfata2...]<br />
{<br />
/* Corpul interfetei:<br />
Declaratii de constane<br />
Declaratii de metode abstracte<br />
*/<br />
}<br />
interface Exemplu {<br />
int MAX = 100; // echivalent cu:<br />
public static final int MAX = 100;<br />
int MAX; // Incorect, lips<st<strong>ro</strong>ng>este</st<strong>ro</strong>ng> initializarea<br />
private int x = 1;<br />
// Incorect, modificator nepermis<br />
void metoda(); // Echivalent cu:<br />
public void metoda();<br />
p<strong>ro</strong>tected void metoda2();<br />
// Incorect, modificator nepermis<br />
3