0

When ever i run this program i get David4215.9Z but i want David,42,15.9,Z how to achieve my target ???

class MyClass { public static void main(String[ ] args) { String name ="David"; int age = 42; double score =15.9; char group = 'Z'; System.out.println (name + age + score + group); } https://code.sololearn.com/cnmNWTh8bUoE/?ref=app https://code.sololearn.com/cnmNWTh8bUoE/?ref=app

18th Jun 2018, 4:26 AM
Kumar Purushottam
Kumar Purushottam - avatar
1 Answer
+ 4
Kumar Purushottam Just add ", " between the + operators like this. System.out.printIn(name + ","+age+","+score+","+group); It will output what you wants to.
18th Jun 2018, 4:40 AM
Akash Pal
Akash Pal - avatar