0
How to run all testcases at once
Unable to run 2 test cases at once Need help.... Convert US date to EU date https://code.sololearn.com/cc0MPnOTg0hJ/?ref=app
3 Réponses
0
Create a new method outside main() that takes a string input and prints the result, containing all the program logic.
Use the main() function to call this method multiple times with different parameters.
0
//
public void format(String dateStr) {
//...
}
//... main(...)
p.format("25/11/2019");
p.format("1/1/2021");
}
----------
but this is wrong:
//formatter = new SimpleDateFormat("25/11/2019");
"25/11/2019"is not a meaningful parse format like ("M/d/y")
you need assign Date object:
try {
date = formatter.parse(dateStr); //dateStr = "25/11/2019"
0
EDIT