Knowee
Questions
Features
Study Tools

Objective:At the end of the exercise, the students should be able to:Write a Java application interface that will extend to other interfaces.Instructions:Using JCreator, create a new Java application file and write the following code. Name the file as java:public interface Sports {   public void setHomeTeam(String name);   public void setVisitingTeam(String name);}Create another Java interface file that will extend the java interface using the extends keyword. Provide at least three (3) additional methods for this Java application file similar to the ones on the Sports.java interface.Submit a soft copy of your Java program files to the instructor for grading.

Question

Objective:At the end of the exercise, the students should be able to:Write a Java application interface that will extend to other interfaces.Instructions:Using JCreator, create a new Java application file and write the following code. Name the file as java:public interface Sports {   public void setHomeTeam(String name);   public void setVisitingTeam(String name);}Create another Java interface file that will extend the java interface using the extends keyword. Provide at least three (3) additional methods for this Java application file similar to the ones on the Sports.java interface.Submit a soft copy of your Java program files to the instructor for grading.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here are the steps to create a Java application interface that extends to other interfaces:

  1. Open JCreator (or any Java IDE you are using).

  2. Create a new Java interface file. To do this, go to File > New > Java Interface.

  3. Name the interface as "Sports" and write the following code:

public interface Sports {
   public void setHomeTeam(String name);
   public void setVisitingTeam(String name);
}
  1. Save the file.

  2. Create another Java interface file that will extend the "Sports" interface. To do this, go to File > New > Java Interface.

  3. Name this new interface as per your choice and write the following code:

public interface ExtendedSports extends Sports {
   public void setReferee(String name);
   public void setMatchDate(String date);
   public void setStadium(String name);
}

In the above code, setReferee(String name), setMatchDate(String date), and setStadium(String name) are the three additional methods similar to the ones in the "Sports" interface.

  1. Save the file.

  2. Now, you have created a Java application interface that extends to other interfaces. You can submit these files to your instructor for grading.

This problem has been solved

Similar Questions

how to write java appliaction

Interfaces in Java can be used to achieve:Question 4Answera.Multiple inheritance.b.Code encapsulation.c.Method overloading.d.Static method implementation.

how to write java application

In Java programming, the keyword used to implement an interface in a class is:Question 4Answera.usesb.extendsc.requiresd.implements

elect the correct answerWhich of the following is true about interfaces in java.1) An interface can contain following type of members.....public, static, final fields (i.e., constants)....default and static methods with bodies2) An instance of interface can be created.3) A class can implement multiple interfaces.4) Many classes can implement the same interface.Options2, 3 and 41, 2 and 41, 3 and 41, 2, 3 and 4

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.