Where did I go wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
15th Jan 2021, 3:22 AM
Name
Name - avatar
24 Answers
+ 5
Name Sololearn terminal is online terminal so everytime you can't take user input. If you have multiple input then you have to take all input once. In this case of your code you can take input like this in seperate line. 2 //total number of elements in array 123 //1st value of 1st array AJ //1st value of 2nd array 567 //2nd value of 1st array Name //2nd value of 2nd array. If you take it in one line then it would be considered as single input
15th Jan 2021, 4:47 AM
A͢J
A͢J - avatar
+ 4
Name Everything is working fine. Where are you getting problem?
15th Jan 2021, 3:43 AM
A͢J
A͢J - avatar
+ 3
Everything is fine Give input like this 2 2 37 29 Name Pankaj This is an example of your input
15th Jan 2021, 3:41 AM
Atul [Inactive]
+ 2
Name Ok sorry it's mistake.
15th Jan 2021, 4:52 AM
A͢J
A͢J - avatar
+ 2
No in java you can do like this String name="Atul"; System.out.println("Name="+name);
15th Jan 2021, 5:02 AM
Atul [Inactive]
+ 2
Name You should always write comment in your code for better understanding. That's the reason we have single and multiple line comment in mostly every language.
15th Jan 2021, 8:20 AM
A͢J
A͢J - avatar
+ 1
Name Now see again.
15th Jan 2021, 4:54 AM
A͢J
A͢J - avatar
+ 1
ok now it's clear 2 - - length 3 - - arr1[0] aj - - arr2[0] ........ Thanks And one more question... In python we wrote x = input("Name: ") Can I do it in Java too?
15th Jan 2021, 4:59 AM
Name
Name - avatar
+ 1
You can use comments for that if you use sololearn
15th Jan 2021, 6:57 AM
Atul [Inactive]
+ 1
Ok got it... and in python we use GUI(Graphical User Interface) , is there anything similar to GUI in Java?
15th Jan 2021, 8:22 AM
Name
Name - avatar
+ 1
It looks gud to me
16th Jan 2021, 8:43 AM
Newman Richard
0
Atul, why I need to mention length twice?
15th Jan 2021, 3:47 AM
Name
Name - avatar
0
AJ what the error means if I write... 2 4 6 AJ Atul
15th Jan 2021, 3:47 AM
Name
Name - avatar
0
Everything is correct! The problem is in the Sololearn IDE which takes all the inputs at once. example: - input: 2 1 One 2 two Output: [ 1, 2 ] [ one, two ]
15th Jan 2021, 3:50 AM
Vicky
Vicky - avatar
0
Atul if I enter like you the first array contains 2 integer... ok... And though the second array contains String but 37 replaces Pankaj.
15th Jan 2021, 3:51 AM
Name
Name - avatar
0
Vicky will the same error occur in other IDEs? Do I need to enter in this formation in other IDEs? Or it's for sololearn only?
15th Jan 2021, 3:53 AM
Name
Name - avatar
0
Name if you give one example of your input then it will be more understandable to me
15th Jan 2021, 4:31 AM
Atul [Inactive]
0
Atul, 2 - - length 4 6 - - two integers for array 1 Atul Atul - - two strings for array 2 It says error... If I enter like you 2 2 37 29 Name Pankaj Where is Pankaj in array 2?
15th Jan 2021, 4:47 AM
Name
Name - avatar
0
Aj you wrote second value of first array is Aj... but 1st array takes integers only.. 😕
15th Jan 2021, 4:51 AM
Name
Name - avatar
0
Name give inputs in different lines
15th Jan 2021, 4:55 AM
Atul [Inactive]