+ 2

The need for "opposite of concatenation" in java

I was trying to print an increasing number of stars(*)from top to bottom, something like this. * ** *** **** I succeed in printing the pattern with the help of concatenation. But wen i try to print the reverse of the pattern with slight modification of the code i dont succeed. Well i guess its because the opposite of concatenation don't exist in java. https://code.sololearn.com/c9460d3qcNzt/?ref=app https://code.sololearn.com/cA5Xr7wW8Jy8/?ref=app Can anyone help me print the reverse of the pattern

25th Mar 2019, 7:21 PM
stephen haokip
stephen haokip - avatar
5 Respuestas
+ 12
You are absolutely correct in your approach. There are just 1 typo in your code:- • Change -= to += on line no. 10 And if you want reserve pattern, then you need something like this: https://code.sololearn.com/cQiHefZ2MS7e/?ref=app
25th Mar 2019, 7:25 PM
Letsintegreat
Letsintegreat - avatar
+ 5
Oh, I thought you wanted to print this pattern: mmmmm mmmm mmm mm m
25th Mar 2019, 7:33 PM
Jan Štěch
Jan Štěch - avatar
+ 3
Yea thats it jan
25th Mar 2019, 7:38 PM
stephen haokip
stephen haokip - avatar
+ 2
You need to assign value "mmmmm" on line seven instead of empty string. Instead of using -=, you will have to use a string function. I will try to find it and then post it here.
25th Mar 2019, 7:27 PM
Jan Štěch
Jan Štěch - avatar