+ 5
[CHALLENGE] Simple task
This was My 1st homework in my java course *Use println(), print(), and string concatenation to display a date, in two different ways. Inside main(), declare these variables: dayOfWeek (a String) month (a String) dayInMonth (an int) year (an int). Then assign values to the variables to represent a particular date. E.g., "Tuesday", "January", 26, and 2017. Then, print the date in American format, like this: "Tuesday, January 26, 2017." For this way, use string concatenation.
3 ответов
+ 7
String dayOfWeek, month;
iny dayInMonth, year;
dayOfWeek = " Tuesday";
month = " January";
dayInMonth = 26;
year = 2017;
System.out.println(dayOfWeek + ", " + month + "," + dayInMonth + year + ".");
+ 12
System.out.println(dayOfWeek + ", " + month + " " + dayInMonth + ", " + year);