0

Why is this wrong?

I want to concatenate but it is giving errors. Can you help me..Please modify the code if it is wrong https://code.sololearn.com/ccbWvD8Teqqd/?ref=app

2nd Jul 2021, 12:44 PM
Mohit Gehilot
Mohit Gehilot - avatar
10 ответов
+ 2
Are you trying to concatenate the arrays or the strings?
2nd Jul 2021, 12:57 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Here's a couple of examples https://www.programiz.com/java-programming/examples/concatenate-two-arrays#:~:text=In%20order%20to%20combine%20(concatenate,by%20using%20arraycopy()%20function.
2nd Jul 2021, 1:21 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Thanks alot🔥
2nd Jul 2021, 1:22 PM
Mohit Gehilot
Mohit Gehilot - avatar
+ 1
Well you have several problems with your code. 1. There isn't a concat method for Array or Arrays. 2. You didn't import Array or Arrays etc 3. You have syntax errors trying to use [] square brackets for your arrays or for the the method call (not sure which you intended due to placement). Parentheses are used with method calls. So if there were a concat method for the Array class then it would look more like; Array.concat() // doesn't exist Then arrays are made using curly braces {} like; {1,2,3,4,5}
2nd Jul 2021, 1:16 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Can you please modify and send me the code
2nd Jul 2021, 1:19 PM
Mohit Gehilot
Mohit Gehilot - avatar
+ 1
Javascript is not the same as Java.
2nd Jul 2021, 1:24 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You are using Array declaration and concatenate methods of js in Java. That works in js . But not in Java.
2nd Jul 2021, 1:26 PM
Jayakrishna 🇮🇳
+ 1
Well, I'm not learning but I'm always in a class where java is being taught. The .concat() method you used only works in Javascript but not Java as both are not related in anyway.
3rd Jul 2021, 5:45 PM
Rilanitech
Rilanitech - avatar
0
Array
2nd Jul 2021, 12:59 PM
Mohit Gehilot
Mohit Gehilot - avatar
0
Is it same for JS?
2nd Jul 2021, 1:23 PM
Mohit Gehilot
Mohit Gehilot - avatar