+ 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.

7th Oct 2017, 2:10 PM
Geena Nana
Geena Nana - avatar
3 Respostas
+ 7
String dayOfWeek, month; iny dayInMonth, year; dayOfWeek = " Tuesday"; month = " January"; dayInMonth = 26; year = 2017; System.out.println(dayOfWeek + ", " + month + "," + dayInMonth + year + ".");
7th Oct 2017, 7:16 PM
Vukan
Vukan - avatar
+ 12
System.out.println(dayOfWeek + ", " + month + " " + dayInMonth + ", " + year);
7th Oct 2017, 2:23 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
7th Oct 2017, 3:26 PM
Geena Nana
Geena Nana - avatar