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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, mayaparness
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, aesthetickait
How do you take a green screen out of the video while editing?
Answers: 2
image
Computers and Technology, 23.06.2019 16:00, keyonaemanieevans
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
image
Computers and Technology, 24.06.2019 10:20, silviamgarcia
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
You know the right answer?
Consider the implementation of the Date class shown below. public class Date
{
private...

Questions in other subjects:

Konu
Mathematics, 21.02.2020 01:17