In c# you have an elegant way to format an string. Im not sure if this is also known in java, but you have the same possibilities in both languages.

take a short look of the differences:

c#:

java:

Note here in java, you have to format the type of the object explicit.

The number is the index of the object, and the “s” means to convert to string using .toString(). There are many other conversions available and formatting options: Link

String formatter in c# and java
Tagged on:     

Leave a Reply

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers:

Welcome Damir Kusar

Log in

Lost your password?
%d bloggers like this: