0
I have a problem with classes.
Is there a specific word used to refer to how classes are used or work in java I keep leaving but then come back because I really want to learn but theres so much to digest. Say I have a class that extends an interface that has methods what actually happends behind the scenes and what do I have to do to use that class.
3 ответов
+ 5
Nobody
Yeah, you should provide implementation to all of it's unimplemented methods and fields... for doing this you should use " implements" keyword.
Ex :
interface MyInterface
{
public void sound();
}
class A implements MyInterface
{
public void sound()
{
System.out.println("peepeeep...");
}
}
+ 5
Nobody Classes are used with keyword "class" and along with class name you can put whatever you want as a class name .
Ex :
class MyClass { // your code here }
and also Java classes can't extends interfaces but, they implement interfaces . that mean a class can provide implementation of all fields and methods of that interface .
Hope you understand...
0
Navya Sri sorry I mean implement what do I need to do once my class has implemented a interface? Thanks