They are purely abstract classes.So no function can have defination in an interface.Interfaces consists of methods that are of type public and abstract and variables that are of type public ,static and final.Even if we dont mention these modifiers before the variables and methods they are of that type by default.
For variables in interface we have to give values there itself as they are final and the choice of giving values in constructor is not available as we cant make objects of interfaces.
Interfaces can inherit multiple interfaces.A class can inherit multiple interfaces. A class cant inherit multiple classes but a class can extend one class and implement more than one interfaces at the same time but the only condition is the keyword extends should always come before the keyword inplement like
Class A extends Class B,implements Interface X,Interface Y{
}
Now if a Class implements an interfac must define all the methods of the interface because if it doesnt implement all the methods of an interface then we have to make this child class abstract as well.
Interface names should start with a capital I(this is not needed anymore) and we can create interface by clicking new and choosing an interface instead of a class
public static void saveObject(ISaveable objectToSave){ //here this function requires an interface reference
Player tim = new Player("Tim",10,15); //but tim referes to class reference but since class player extends interface iSaveable we can pass it to above function like this
saveObject(tim);
ISaveable werewolf = new Monster("werewolf",20,30);
But then to access methods thats are only defined in child class we have to type cast that reference to child class
like this ((Monster) werewolf).getStrength());
//please note we can still access all the methods that are there in interface that the class extends directly
werewolf.write();