0
DATA TYPES:
Question: How to format any assigned value in java like we do in python like this===> Anu="Anurag" print(f"My name is {Anu}") How we do it in java
7 odpowiedzi
+ 2
🌟αnurαg kumαr🌟 you have to try it yourself to find out.
+ 1
🌟αnurαg kumαr🌟
Just do concatenation
System.out.println("My name is " + Anu);
+ 1
Apart from what the others have said, if you don't like concatenation, you can use the System.out.printf function for formatted strings. It is like doing
`"My name is %s" % Anu`
in Python
https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
0
It will return me result
0
🌟αnurαg kumαr🌟
Yes just try in Code Playground
0
Ok thanks very much : )
0
String.format() is like .format python