Java Program to Reverse each Word of a String

  Рет қаралды 86,684

Programming Tutorials

Programming Tutorials

6 жыл бұрын

In this tutorial, I have explained how to reverse each words of a string. Write a java program to reverse each words of a string.
Reverse each Words of a String java code - webrewrite.com/java-program-to...
Reverse String - • Reverse a String in Ja...
Sum of N Natural Numbers - • Sum of First N Natural...
In this tutorial, I have explained how to reverse each words of a string. Write a java program to reverse each words of a string.
The approach is to split input string into words using split() method. Then reverse each individual word and append to revString variable. Finally, we print the output.
Reverse each Words of a String java code -
webrewrite.com/java-program-to...
Paypal - www.paypal.me/programmingtuto...
Website - webrewrite.com/
Programming questions on string :
• Java Program To Count ...

Пікірлер: 75
@bhavinpatel9630
@bhavinpatel9630 6 жыл бұрын
Very nice program, easy to understand and short. Thanks a lot !!!
@ProgrammingTutorials1M
@ProgrammingTutorials1M 6 жыл бұрын
Thanks for your appreciation.
@saurabrakshit405
@saurabrakshit405 4 жыл бұрын
bro how cursor is going to the "Programming" word after the "Java" word can u please explain
@anki1746
@anki1746 4 жыл бұрын
Simple and good 🤗
@ritikabali6466
@ritikabali6466 2 жыл бұрын
loved the explanation and program. easy to understand
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
Thank you
@davidgromin6481
@davidgromin6481 4 жыл бұрын
Thank you so much. This was my homework and now I understand it.
@ProgrammingTutorials1M
@ProgrammingTutorials1M 4 жыл бұрын
Glad it helped!
@saikiran-em8gw
@saikiran-em8gw Жыл бұрын
How we get space btw words after reversing?
@Randoms147
@Randoms147 5 жыл бұрын
nice sir you guys are explaining very important programs for interviews that is very helpful to many students
@ProgrammingTutorials1M
@ProgrammingTutorials1M 5 жыл бұрын
Thank you very much for your appreciation. Also i have mentioned the code link in the description box.
@shyamsinghrawat6070
@shyamsinghrawat6070 3 жыл бұрын
Can I plz do this program easy and simple coz I am unable to understand
@krishna-nakum
@krishna-nakum 4 жыл бұрын
Very nice 👌👌👍
@RehanAhmad1
@RehanAhmad1 10 ай бұрын
Thanks!
@technomini3074
@technomini3074 5 жыл бұрын
Very good explanation. ...I searched a lot of video bt I don't understand....bt your video is very good explanation thankuu srr
@ProgrammingTutorials1M
@ProgrammingTutorials1M 5 жыл бұрын
Thank you very much for your appreciation.
@RehanAhmad1
@RehanAhmad1 10 ай бұрын
While doing the exercise in java , i was stuck for 2 days... thanks for keep me moving.
@bilovely7267
@bilovely7267 4 жыл бұрын
What about if we have two spaces or more between words ? What should I do?
@sushocahtt
@sushocahtt Жыл бұрын
Use trim method for each word
@nitheeshreddy6863
@nitheeshreddy6863 2 жыл бұрын
❣️❣️❣️ super bro we can stringbuilder as well right to implement this problem ..
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
Thank you, yes
@anithak6155
@anithak6155 4 жыл бұрын
I'm a beginner. .I'm in love with java.....please help me to clear my doubts
@jaskaran6513
@jaskaran6513 4 жыл бұрын
well explained sir but I got indentifier expected error in public static void main string. could you please tell me how I can correct it. Thank you!!
@ProgrammingTutorials1M
@ProgrammingTutorials1M 4 жыл бұрын
Can you share your code?
@jaskaran6513
@jaskaran6513 4 жыл бұрын
@@ProgrammingTutorials1M I wrote the same program which you explained.
@VickyKumar-sl4oj
@VickyKumar-sl4oj 6 жыл бұрын
very well Explain...Thanks Bro
@ProgrammingTutorials1M
@ProgrammingTutorials1M 6 жыл бұрын
Thanks for your comment.
@VickyKumar-sl4oj
@VickyKumar-sl4oj 6 жыл бұрын
+Programming Tutorials what I'll do when its dot is there instead of space means if problem is. this.is.a.good.boy
@ProgrammingTutorials1M
@ProgrammingTutorials1M 6 жыл бұрын
Then in split method specify dot(.) as your delimiter instead of space.
@VickyKumar-sl4oj
@VickyKumar-sl4oj 6 жыл бұрын
ya but in last dot(.) is comming. (my.name.vicky ) then( ym.eman.ykciv. ) how to remove dot(.) form last place
@marcroberttretasco1122
@marcroberttretasco1122 2 жыл бұрын
What if I am the one to enter a word?
@pratheekbhat2758
@pratheekbhat2758 5 жыл бұрын
What is the length of words.length() , It counts all the words(2) or character (15)
@ProgrammingTutorials1M
@ProgrammingTutorials1M 5 жыл бұрын
Words is an array of words, So it prints the length of an array. In this case it's 2.
@pratheekbhat2758
@pratheekbhat2758 5 жыл бұрын
@@ProgrammingTutorials1M Thank You🙂
@gottepavani1838
@gottepavani1838 2 жыл бұрын
Can i get the output as avaj programming
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
Here you only want to reverse first word of a string?
@rahulsingh-my3pu
@rahulsingh-my3pu 5 жыл бұрын
nice work
@ProgrammingTutorials1M
@ProgrammingTutorials1M 5 жыл бұрын
Thank you
@shubhamchavan95
@shubhamchavan95 2 жыл бұрын
Can we do same with taking user input?
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
yes
@vigneshb1287
@vigneshb1287 2 жыл бұрын
Split function is a in-built function or not
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
It's in-built function
@manojthayil7836
@manojthayil7836 6 жыл бұрын
Sir why revword ="" is declared in loop
@ProgrammingTutorials1M
@ProgrammingTutorials1M 6 жыл бұрын
Because we are reversing and then concatenating each word.
@thalamaheshnaidu6884
@thalamaheshnaidu6884 5 жыл бұрын
simple solution
@ajitravan3142
@ajitravan3142 2 жыл бұрын
thanks
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
Thank you 🙏
@arihantjain1189
@arihantjain1189 2 жыл бұрын
What is that str.split for? never studied about .split in icse 10th
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
str.split - The string split() method splits a given string around matches of the given regular expression. Code link - webrewrite.com/java-program-to-reverse-each-words-of-a-string/
@gkfactsandquiz3056
@gkfactsandquiz3056 Жыл бұрын
Sir this takes more time than expected to execute, can you just optimize it and upload
@shabaazhussain5576
@shabaazhussain5576 5 жыл бұрын
It will give space at last
@viraltoovideos
@viraltoovideos Жыл бұрын
Very nice sir
@ProgrammingTutorials1M
@ProgrammingTutorials1M Жыл бұрын
Thanks and Keep Watching.
@gottepavani1838
@gottepavani1838 Жыл бұрын
I did same
@sasireka7974
@sasireka7974 3 жыл бұрын
Need bit louder sir and yr videos are nice
@ProgrammingTutorials1M
@ProgrammingTutorials1M 3 жыл бұрын
Thanks, You'll not face any voice related issue in my new videos.
@gottepavani1838
@gottepavani1838 2 жыл бұрын
Hello sir
@Engycation
@Engycation 2 жыл бұрын
I just registered in your chanel now
@ProgrammingTutorials1M
@ProgrammingTutorials1M 2 жыл бұрын
Thank you
@sriramchandra4537
@sriramchandra4537 3 жыл бұрын
bro explanation is awesome but sound is irritating pls i want this video without disturbance
@ProgrammingTutorials1M
@ProgrammingTutorials1M 3 жыл бұрын
Sorry for that, Please check my new videos you won't face this issue.
@ironman-bq6sf
@ironman-bq6sf 2 жыл бұрын
Without split
@gottepavani1838
@gottepavani1838 Жыл бұрын
My output is different from yours y sir
@ProgrammingTutorials1M
@ProgrammingTutorials1M Жыл бұрын
Can you please share your code
@gottepavani1838
@gottepavani1838 Жыл бұрын
@@ProgrammingTutorials1M Same code sir
@gottepavani1838
@gottepavani1838 Жыл бұрын
gnimmargorp avaj
@anithak6155
@anithak6155 4 жыл бұрын
im confused. ...can I get a explanation? ???
@ProgrammingTutorials1M
@ProgrammingTutorials1M 4 жыл бұрын
What's your confusion?
@anithak6155
@anithak6155 4 жыл бұрын
Programming Tutorials I'm a beginner. ..I don't have clarity on for loop
@ProgrammingTutorials1M
@ProgrammingTutorials1M 4 жыл бұрын
@@anithak6155 Ok, I create separate videos to explain basics of programming.
@anithak6155
@anithak6155 4 жыл бұрын
Programming Tutorials ok.... what is the use of 1) string word=words[i]; 2) string revword =" ";
@DHEERAJKUMAR-il8zd
@DHEERAJKUMAR-il8zd Жыл бұрын
write a program to reverse each word in a sentence ( don't use any inbuilt functions) input : my name is john output: ym eman si nhoj can you give a solution to this.........
@gottepavani1838
@gottepavani1838 2 жыл бұрын
Pls sir
Reverse a String using Stack in Java
5:08
Programming Tutorials
Рет қаралды 16 М.
Reverse Each Word In Given String | Java | Ashok IT
12:24
Ashok IT
Рет қаралды 37 М.
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 164 МЛН
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 58 МЛН
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 10 МЛН
Reverse Words in a String | LeetCode 151 | C++, Java, Python
13:58
Knowledge Center
Рет қаралды 171 М.
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,6 МЛН
1. How to Reverse a String in Java - Java Interview Questions (4 ways)
13:33
Solve String Programs in Java
14:37
Simply Coding
Рет қаралды 82 М.
Reverse Words in a String in Java
4:05
Telusko
Рет қаралды 175 М.
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 164 МЛН