4. Of #3, in class Interview above, how many are there any static fields? are de
ID: 3590762 • Letter: 4
Question
4. Of #3, in class Interview above, how many are there any static fields? are defined? Among them, 5. Of #3 above. How its visibility, return type, parameters). are defined? Describe the method result 6. A class cal ss is called CardGame. It has two fields, player of type String and bet of type int. Both fields fields are private. Write the code to declare these two he class CardGame of #6 has the signature uctor? (Choose If a two-parameter constructor of t int bet) public CardGame (String p, Which of the following are correct implementations of the constr ONE correct answers.) bet bi a. player = player; b, player p; c. this.player pi this.betb; bet bet ; this.be t = bet ; d- player p; this,player; bet this.bet; e. p 8. Of #6 above, write the complete code the getter and setter method for the field playerExplanation / Answer
6.
public class CardGame{
private String player;
private int bet;
}
7.
Correct answer is both option c and option d
i.e
this.player = p; this.bet = bet;
player = p; this.bet = bet;
option a and option c is incorrect as there is no variable named b. option b is incorrect as bet is assigned to itself. option e is incorrect as the original variables of the object is not updated, instead the references received from the parameters are modified.
8.
public class CardGame{
private String player;
private int bet;
void setPlayer(String p){
this.player = p;
}
String getPlayer(){
return this.player;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.