subject

Consider the implementation of the Date class shown below. public class Date
{
private int myDay;
private int myMonth:
private int myYear;

public Date( )
{ /* implementation not shown */ }

public Date(int mo, int day, int yr)
{ /* implementation not shown */ }

public int getMonth( ) //returns month of date
{ /* implementation not shown */ }

public int getDay( ) //returns day of date
{ /* implementation not shown */ }

public int getYear( ) //returns year of date
{ /* implementation not shown */ }

//string representation of Date as "m/d/y", e. g. 4/18/1985
public String toString( )
{ /* implementation not shown */ }
}
A separate client/tester class instantiates a Date object named d with the following Java statement:

Date d = new Date (1, 13, 2002);
Which of the following subsequent code segments will cause a compile-time error?

String s = d. toString();
Date e = new Date(1, 13, 2002);
int y = d. myYear;
int x = d. getDay();

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:00
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
You know the right answer?
Consider the implementation of the Date class shown below. public class Date
{
private...
Questions