How do i create a space while printing in java? -


i started learning java today , tried write basic program myself. worked fine while printing value of variable along text, noticed doesn't maintain space between two. how overcome this? see code :

public class helloworld { public static void main(string[] args) {     int a=43;     int b=7;     int c=a+b;       system.out.println("the result is" + c); }  } 

the output the result is50
how can maintain space between is , 50 ?

just add space first string: system.out.println("the result " + c);

in cases have 2 strings not literals (s1,s2) , want concat them space, add literal includes space: s1 + " " + s2


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -