CodeGym /Java Course /Java Multithreading /Practice using String.format

Practice using String.format

Java Multithreading
Level 2 , Lesson 7
Available
Practice using String.format - 1

"Hi, Amigo!"

"No, Diego, that's enough! Do your own tasks!"

"Amigo, buddy. No one is going to do your tasks for you. Do you want to get smarter?"

"Yes."

"When you're at the gym, you don't ask others to pump iron or do crunches for you, do you?"

"No."

"Then you should also do all this work by yourself. I've got some very interesting tasks for you this time:"

12
Task
Java Multithreading, level 2, lesson 7
Locked
String formatting
Correct the getFormattedString method so that it returns a string with format specifiers. Don't use \n to convert carriage returns. The output should be: 20 / 7 = 2.86 Exp = 3.33e+00
6
Task
Java Multithreading, level 2, lesson 7
Locked
I LOVE CodeGym!
Correct the getFormattedString method so that it returns a string with format specifiers. The parameters must be swapped. The output should be: I LOVE CodeGym!
6
Task
Java Multithreading, level 2, lesson 7
Locked
Date formatting
Correct the getFormattedString method so that it returns a string with format specifiers. The output should be something like this: 04:05:18 09:09:09 (month:day:year hours:minutes:seconds)
Comments (10)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
matemate123 Level 50, Kraków, Poland
8 March 2023
https://www.youtube.com/watch?v=IzYCzegyaH0 This guy is helpful when you lost in documentation, but I prefer use documentation like a map for looking for adequate letter. If you watch carefully, you'll find information needed for overcome conditions in tasks. Great guide.
Andrei Level 41
30 March 2021
Man, I started with the easy ones, bashed my head against my keyboard for not knowing, searched the internet, looked at the help section, used the mentor solution and then, at the Medium difficulty one, I did it by myself from the first try. Looks like something stuck to me after all lol
Ruslan Skaldin Level 33, Tashkent, Uzbekistan
25 January 2021
For String formatting very useful would be official Java docs: https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
SOUFIANE DAHIMI Level 32, Marrakech, Morocco
19 March 2020
I hope you'll find those ressources useful : codegym.cc/groups/posts/string-format https://www.geeksforgeeks.org/format-specifiers-in-java/ https://www.dotnetperls.com/format-java
BlueJavaBanana Level 37
5 July 2020
I'd like to add this one too... https://dzone.com/articles/java-string-format-examples
Jeanine Kimball Level 26, New London, United States
19 August 2020
I should have looked here before searching the internet.
Seb Level 41, Crefeld, Germany
15 January 2020
I'd say the "Link to additional material" from the previous lesson came in quite handy here. :-)
19 December 2019
24 hours worked for me
Hossein Shams Level 26, Atlanta, United States
24 October 2019
On the last task, hour is based on 12 hours time not military 24 hours
Ewerton Level 30, Belo Horizonte, Brasil
10 July 2019
Nice trick to learn :)