Question: Question 33 Which part of a class implementation contains the instructions to initialize an object's instance variables? constructor access specifier initializer type name Question 34



Question 33 Which part of a class implementation contains the instructions to initialize an object's instance variables? constructor access specifier initializer type name Question 34 of 50 Question 34 0.4 points We want to create a class that represents a date. A date has a day, month, and year. For example, the date March 16, 2014 has the day 16, month 3, and year 2014. The basic framework of a date class is below. public class Date { private int day; private int month; private int year; We want to create a specific date using code like: Date first - new Date (16,3, 2014); // Creates March 16, 2014 Date second new Date (1,9, 2013); W Creates September 1, 2013 Which of the constructor specifications below will allow this code to behave as desired? public void Date (int d, int m, int y) public init (int d, int m, int y) public Date (int d, int m, int y) public Date Date (int d, int m, int y) Question 35 How do you compute the length of the string str? length(str) length.str O str.length str.length() Question 36 Which of the following is a valid constructor header for the Player class that accepts the player name as a parameter? public void Player(String playerName) private Player(playerName) private void Player(playerName) public player(String playerName)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
