Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this needs to be in JAVA... public interface Playable 1. Declare an integer property named NUM_PLAYERS and initialize it with a value of 2. 2.

this needs to be in JAVA... public interface Playable

1. Declare an integer property named NUM_PLAYERS and initialize it with a value of

2. 2. In a Java comment, answer: What is the access level of this property? Is it a class or instance property?

3. Declare the following four methods, all of which have no parameters and no return type: a) initPlayers b) play c) evaluateRound d) displayResults

4. In a Java comment, answer: What is the access level of these methods? Are they abstract or concrete?

5. Like Classes, Interfaces require Javadoc.

image text in transcribed

public abstract class Game implements Playable 1. Declare the following properties to be inherited by concrete child classes: a) An int property named numRounds b) An array of Player objects named players. c) A Scanner named in 2. Create a constructor which received a parameter of type int. a) Use the parameter value to initialize the number of rounds property b) Initialize the array of Player objects to the size specified by the NUM PLAYERS property inherited from the interface Playable c) Initialize the Scanner property using System.in d) Invoke the initPlayers method e) In a Java comment, answer: How can the Game class invoke the method initPlayers without getting an error, if it has not yet been defined? 3. Override the finalize method of the Object class. Try to invoke the close method of the Scanner object. If an Exception is caught, do nothing try myScanner.close(); catch (Exception e) public abstract class Game implements Playable 1. Declare the following properties to be inherited by concrete child classes: a) An int property named numRounds b) An array of Player objects named players. c) A Scanner named in 2. Create a constructor which received a parameter of type int. a) Use the parameter value to initialize the number of rounds property b) Initialize the array of Player objects to the size specified by the NUM PLAYERS property inherited from the interface Playable c) Initialize the Scanner property using System.in d) Invoke the initPlayers method e) In a Java comment, answer: How can the Game class invoke the method initPlayers without getting an error, if it has not yet been defined? 3. Override the finalize method of the Object class. Try to invoke the close method of the Scanner object. If an Exception is caught, do nothing try myScanner.close(); catch (Exception e)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions