Write the code below for the two interfaces described given the rules below.Â
The Network has two methods called connect and disconnect. The connect method takes a String argument called networkName and returns a boolean. The disconnect method returns a boolean and takes no arguments.Â
The Ethernet interface inherits from the Network interface and adds two methods: plug and unPlug. The plug method takes an integer as argument called port and returns a boolean. The unPlug method returns a boolean and takes not arguments.
public interface Network {
boolean connect(String networkName);
boolean disconnect();
}
public interface Ethernet extends Network{
boolean plug(int port);
boolean unPlug();
}
Comments
Leave a comment