+ 2
Where did I go wrong?
24 ответов
+ 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
+ 4
Name
Everything is working fine. Where are you getting problem?
+ 3
Everything is fine
Give input like this
2
2
37 29
Name Pankaj
This is an example of your input
+ 2
Name Ok sorry it's mistake.
+ 2
No in java you can do like this
String name="Atul";
System.out.println("Name="+name);
+ 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.
+ 1
Name Now see again.
+ 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?
+ 1
You can use comments for that if you use sololearn
+ 1
Ok got it... and in python we use GUI(Graphical User Interface) , is there anything similar to GUI in Java?
+ 1
It looks gud to me
0
Atul, why I need to mention length twice?
0
AJ what the error means if I write...
2 4 6 AJ Atul
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 ]
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.
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?
0
Name if you give one example of your input then it will be more understandable to me
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?
0
Aj you wrote second value of first array is Aj... but 1st array takes integers only.. 😕
0
Name give inputs in different lines