+ 1
How to concatenate two strings in Java?
Its a question on hackerrank and I am unable to do it
20 Answers
0
Only imports are util,regex,text,math,io
+ 11
You can simply use the + operator or String's concat() method. Or use StringBuilder.
You should add an example code to show where you're stuck if you need further information.
+ 9
Bosnia & Herzegovina
+ 8
Germany and I don't know how to get a job in the USA or UK. I guess the first step would be to apply for a job 🤔
But I think a feed post is better suited for such a survey rishabh tesla.
+ 6
Mick Did you receive a message? Should be shown on the right of your notifs. If not you might need an update.
I'll remove the off-topic posts in here..
+ 4
rishabh tesla Germany. I would try to use the search bar (there are a lot of posts of how to get a job) and if you don't find enough information, post a new question.
+ 3
rishabh tesla nextLine() reads the full line.
Maybe your problem is a wrong way to input.
Reading two strings using Scanner.nextLine():
First String [Enter]
Second String
Wrong: first String [space] second String
+ 3
rishabh tesla
Just test this in the code playground:
Scanner scan = new Scanner(System.in);
String one = scan.nextLine();
String two = scan.nextLine();
System.out.println(one + " " + two);
Write each String in a separate line:
Input: Hello, my
name is ...
Output: Hello, my name is ...
+ 1
Tashi N no, I didn't. I will update the app
0
Actually its a question there are two string s and t s is given and t we have to input but its a big line so i have to read the string t and then concatenate it .i have tried the + operator .i think i am stuck in reading the string since string t is a long sentence
0
For eg string s contains hackerrank and string t contains "is a good place for coding"
0
Now i use the + operator but its only showing hackerrank since i use nextline method for reading string
0
And i am unable to use readline method since the imports are default and cannot be changed
0
Perhaps something like this snippet:
String s = "Hackerrank ";
Scanner in = new Scanner(System.in);
String t = in.nextLine();
System.out.println(s + t);
0
Dennis Colburn it is not taking the whole line ,theres a whole sentence with space
0
How to read a full line
0
0
?
0
How can i get a job in usa or uk ?