How to Reverse a String - Java Interview Question -1

  Рет қаралды 301,230

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 121
@naturegallery1348
@naturegallery1348 6 жыл бұрын
Enga jii irundhinga ivlo naala.. Very nice Thanks and keep rocking.
@khajazakiuddin931
@khajazakiuddin931 6 жыл бұрын
One of the best explanation for the concept of immutable. Thanks a lot Naveen. Many interviewers have asked this question,
@yojanarahangdale4862
@yojanarahangdale4862 6 жыл бұрын
Hi, Naveen your all videos are very helpful. Thanks a lot, I cleared many interviews and many interviewers ask the questions which are covered by you.
@garimayadav2790
@garimayadav2790 3 ай бұрын
Best explanation ever for reversing the string... Thanks a lot Naveen :)
@manojannamalai724
@manojannamalai724 6 жыл бұрын
Good explanation about how to reverse the I have ever heard
@artimandale8286
@artimandale8286 9 ай бұрын
Very well explained, crystal clear . Thanks a ton, Naveen
@SurajSaini
@SurajSaini 6 жыл бұрын
Your every line in every video is true, in one interview some one ask this question, I told her , we can use reverse method, after that she told me u can wait outside HR will give feedback :( but now I can give proper answer :)
@gangadharreddy4606
@gangadharreddy4606 Ай бұрын
Thank you so much for this series..... much needed for the community. tq.
@anils1993
@anils1993 3 жыл бұрын
Thank you Naveen. These program asked in interview and i cracked it.
@harshita0302
@harshita0302 3 жыл бұрын
Sir I am big fan of your explanation.I would say that you are god of testing and your approach towards concept explanation is impeccable
@anushasrinivas564
@anushasrinivas564 4 жыл бұрын
Commenting first time in KZbin...... U r doing a great job sir 👏👏👏👏understood clearly
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Appreciate your comments and feedback. Keep learning Anusha.
@anushasrinivas564
@anushasrinivas564 4 жыл бұрын
@@naveenautomationlabs Sure Sir.... Thank you 😊Sharing the videos to my friends as well
@goaheadskinit
@goaheadskinit 4 жыл бұрын
Just randomly came across your channel and your videos are extremely helpful. Thank you so much🙏🏻
@saurabht09
@saurabht09 3 жыл бұрын
Naveen is the king in Automation...his video gives you confidence that you can achieve everything in Automation testing..we all should thanks him for helping us👍❤️
@4sacademy433
@4sacademy433 5 ай бұрын
It's the right time I found you 👍🧠👌, where you gone man!🔥
@bheemshankar_pk
@bheemshankar_pk 4 жыл бұрын
For the first I got to know this for loop logic great explanation sir thank you
@prashanthiskvl1885
@prashanthiskvl1885 7 жыл бұрын
This is very clear naveen. Thanks for explaining line by line
@naveenautomationlabs
@naveenautomationlabs 7 жыл бұрын
Thanks for watching :)
@harrysaini2326
@harrysaini2326 7 жыл бұрын
thanks naveen for starting this series , make more videos on java programs and questions for selenium interview
@mdshakhawathossain7256
@mdshakhawathossain7256 4 жыл бұрын
i wanna say u are my boss... thanks a a lot..
@nareshreddy69
@nareshreddy69 5 жыл бұрын
Good Explanation Naveen.... :) BTW Just this line also will work for (int i=len-1;i>=0;i--) { System.out.print(s.charAt(i)); }
@sauravhateme
@sauravhateme 4 жыл бұрын
For reversing a string i always use recursion, because recursion utilizes stack data structure to save every characters. We just need to pop, the last chracters coming out and print the chars. I love these concepts!! @naveen ! 🙏🏻
@piyumigunawardana4610
@piyumigunawardana4610 5 жыл бұрын
in fact i did say, 'yes' when the interviewer said 'we can use reverse function, right?' now i know, why i wasnt selected from it 😂😂
@oopsididitagain8572
@oopsididitagain8572 5 жыл бұрын
Thanks Naveen. Again and again I have the same question "How can a human dislike this video? "
@bhaskarreddy9042
@bhaskarreddy9042 7 жыл бұрын
thanks naveen for starting the series , make more videos on java interview questions(logical questions ), it will be more useful
@PankajKumar-qk8oh
@PankajKumar-qk8oh 6 жыл бұрын
Great explanation..pls upload more coding interview questions
@nitingupta82
@nitingupta82 5 жыл бұрын
Thank You for making it look like such a Simple program!
@naveenautomationlabs
@naveenautomationlabs 5 жыл бұрын
Thanks for watching
@nishantrajput4183
@nishantrajput4183 Жыл бұрын
nice, thanks for this video it helps me with my revision of String
@kirind7181
@kirind7181 4 жыл бұрын
Thanks for the clear explanation! very easy to understand :)
@babitathakur950
@babitathakur950 6 жыл бұрын
Hi naveen, really appreciated your hard work here. Amazing videos these are!!! I have learnt a lot. Please can you help me get get more sample java programs being asked in interviews. Thanks
@nikhilgosavi4300
@nikhilgosavi4300 3 жыл бұрын
Thank you for this..saved my life🥰
@arijitmohapatra147
@arijitmohapatra147 3 жыл бұрын
Thanks a lot sir 👍 really the best vdo evr ❤️❤️
@sunayanagandra7173
@sunayanagandra7173 6 жыл бұрын
Thanks for helping people who are interested to learn java. Can you please post more java coding interview questions for automation
@nikhiltillu6201
@nikhiltillu6201 6 жыл бұрын
Nice video, good help! Thanks
@dabbark
@dabbark 6 жыл бұрын
Nice explanation. Thanks for the video.
@kirankumarmothukuri7660
@kirankumarmothukuri7660 4 жыл бұрын
Very good explanation bro.....Keep rocking I have subscribed your channel with this one video.
@saurabht09
@saurabht09 3 жыл бұрын
Genius Naveen 👍🙏🙏
@SmartProgramming
@SmartProgramming 6 жыл бұрын
sir good one, keep it up 👍👍
@AKHILDS-j3v
@AKHILDS-j3v 6 жыл бұрын
nicely explined...thanks naveen sir
@arpitapatil5109
@arpitapatil5109 3 жыл бұрын
Well explained sir tq
@thewildone1015
@thewildone1015 6 жыл бұрын
I'm glad I found you
@shreyagarg2848
@shreyagarg2848 5 жыл бұрын
Naveen, please share videos for triangle pattern. This video is super easy to understand.
@tanishasharma7542
@tanishasharma7542 6 жыл бұрын
your explanation way is simple and easy. thanks:)keep sharing more videos on java interview..can you also start sharing about puzzles ---> 2 egg problem and 011111 matrix
@sushkund4198
@sushkund4198 2 жыл бұрын
Hi Naveen These videos are great and I really appreciate your efforts. Thanks a lot for the great videos. Help Needed: Can you please provide C# related interview preparation videos. It helps a lot.
@Wabi258
@Wabi258 6 жыл бұрын
thanks, bro it clear my all of my confusion
@mudaseer21
@mudaseer21 6 жыл бұрын
Nice explanation
@soumyabohre1484
@soumyabohre1484 2 жыл бұрын
Very well explained
@jeyhunaliyev1765
@jeyhunaliyev1765 5 жыл бұрын
great the way you explaining fantastic
@sai3327
@sai3327 4 жыл бұрын
StringBuffer S = new StringBuffer("Selenium"); System.out.println(S.reverse()); Also applies to buffer and builder a bit shorter way
@saurabht09
@saurabht09 3 жыл бұрын
Second one is very simple ❤️❤️
@prakharsrivastav9416
@prakharsrivastav9416 2 жыл бұрын
Thank you sir I appreciate your effort
@rakesjjjjj
@rakesjjjjj 6 жыл бұрын
naveen plz make some videos on sql used in manual testing plzz
@sarjeraosandbhor4478
@sarjeraosandbhor4478 6 жыл бұрын
Hi Naveen, Very nice & now feeling confident about Java & Automation with the help of your videos. Thanks. Can you please share a Java Program to Reverse words in a sentence. Ex. Java is so easy Ans. easy so is Java
@rockgemini
@rockgemini 3 жыл бұрын
Printing inside the loop works if we use print() instead of println(). e.g. this: for (int i=s.length()-1; i>=0; i--){ System.out.print(s.charAt(i)); }
@emilioalvarado7720
@emilioalvarado7720 5 жыл бұрын
that is a perfect explenation
@sumitkumar-xz2tv
@sumitkumar-xz2tv 11 ай бұрын
best explanation
@USP7
@USP7 7 жыл бұрын
Currently working as Test Lead in MNC, looking forward to learn qlikview Developer course . Please suggest should I go ahead.
@santhoshthaduri899
@santhoshthaduri899 7 жыл бұрын
Thanks naveen, make a video for print dupilicate elements using recursive function
@joshuajibi4249
@joshuajibi4249 4 жыл бұрын
thanks bro awesome explanation
@இன்பதேன்வந்துபாயுதுகாதினிலே
@இன்பதேன்வந்துபாயுதுகாதினிலே Жыл бұрын
Phenomenal
@ashwinkumarmahakul7620
@ashwinkumarmahakul7620 7 жыл бұрын
HI Naveen pls release video related exception handling in java .
@seasam13
@seasam13 6 жыл бұрын
Thanks for all your Knowledge
@arunc8342
@arunc8342 5 жыл бұрын
Hi Naveen, What is the difference between string builder and string buffer. We can use string builder as well to reverse the string.
@sultanatasneem1787
@sultanatasneem1787 4 жыл бұрын
Thank you so much 😍
@sambhawjain2201
@sambhawjain2201 6 жыл бұрын
Hi Q - where use the static class in framework in selenium
@kollabathulasowjanya1610
@kollabathulasowjanya1610 7 жыл бұрын
Hi Naveen, even using stringbuilder class and its reverse function we can reverse a string?
@littletech5828
@littletech5828 7 ай бұрын
series for only tester or developer?
@vaalibankarthick7290
@vaalibankarthick7290 6 жыл бұрын
Hi Naveen, Could u execute Fibonacci series
@amolnawale2177
@amolnawale2177 6 жыл бұрын
Hi Naveen, If I want the reverse output of the String 'Hello Naveen' as 'olleH neevaN' instead of 'neevaN olleH', then how do we do that?
@vishalgaikwad873
@vishalgaikwad873 6 жыл бұрын
same here Naveen.
@jeffreysoboe
@jeffreysoboe 6 жыл бұрын
You would have to first split the string on the " "... then reverse each individual word.
@FAyt-ov5uo
@FAyt-ov5uo 5 жыл бұрын
Very helpful thank you
@poojachavan9597
@poojachavan9597 6 жыл бұрын
Thanks Naveen sir
@sufidas9458
@sufidas9458 6 жыл бұрын
Hi Naveen, I like all your videos and learned a lot from your videos. I have 1 question about reverse string. Srtring=" selenium" your taking, while reversing the string I want "u" not to be printed. Can you please let me know.
@mozesong5264
@mozesong5264 6 жыл бұрын
use an if statement to check if the char == u then char = ""
@nikhiltillu6201
@nikhiltillu6201 6 жыл бұрын
String s = "Selenium"; int len = s.length(); String rev= ""; char ch; for(int i = len -1; i>=0; i--) { ch = s.charAt(i); if(ch != 'u') { rev = rev + ch; } } System.out.println(rev);
@AjeetSingh-ti2yg
@AjeetSingh-ti2yg 3 жыл бұрын
Hi Naveen, String s= "my code is not working" hear I .... 'My and working 'should revers and 'code is not 'should be upper case but it should not revers could you please suggest me what is approch for this Thanks in advance
@venugopal548
@venugopal548 4 жыл бұрын
Please cover all these too: marshalling, transient, serialization, serialized keyword
@prakashmarketing
@prakashmarketing 7 жыл бұрын
class ReverseString { public static void main(String args[]) { String str="Hello World"; StringBuffer br=new StringBuffer(str); br.reverse(); System.out.print(br); } }
@shreyashikha3506
@shreyashikha3506 7 жыл бұрын
If we don't use string reverse =" "; then what will happen ?
@ozzDeveveloperOpenForWork
@ozzDeveveloperOpenForWork 5 жыл бұрын
great explanation thank you! but why do we need to assign an int and do length? why cant we do the for loop and just let it reverse it. Whats the concept behind taking the length of the string in int data?
@sharanyabhiram3601
@sharanyabhiram3601 9 ай бұрын
I have one java programming question to solve I give Input as 5 And type random binary numbers as input 1 0 1 1 1 My output should convert that binary number to decimal number 23
@ujjwalverma7787
@ujjwalverma7787 6 жыл бұрын
sir, please help me i really confuse between them what is the difference between the "array.length and array.length()" some time array.length will work and some time array.length() will work. is there is any rules for is for using it? with String arr.length() will work but when we use an integer type, its work with array.length.
@sachinhodlur7193
@sachinhodlur7193 6 жыл бұрын
Hi, length. It is a final variable applicable only for arrays It represents size of array For example Int[] a = new int[10]; Sop(a.length); //10 Sop(a.length()); // compile time error length(). It is a final method applicable only for String Objects It represents the number of Characters present in String For example String s ="Java"; sop(s.length()); //4 Sop(s.length); // compile time error
@sardarnijaspreetkaur4273
@sardarnijaspreetkaur4273 11 ай бұрын
Does this series still holds good in the market ?
@MBindu-kc2nj
@MBindu-kc2nj 2 жыл бұрын
Thank you
@shindeajinkya2506
@shindeajinkya2506 3 жыл бұрын
Sir i had a doubt lenght of a string is 7 then in loop condition when we minus it by 1 then it should start the printing from "U" or I'm wrong plz clear my doubt.... I am really confused in that condition 😕
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
You have to start with len-1. As first Index will start from zero always.
@shindeajinkya2506
@shindeajinkya2506 3 жыл бұрын
@@naveenautomationlabs thank u sir I really appreciate it ❤💯
@shindeajinkya2506
@shindeajinkya2506 3 жыл бұрын
Sir will u plz make a separate video on "interface - implement " and plz Don't mind me ,if I'm asking too much bcz they're asking really tougher questions on these concepts(interface,implement, inheritance, overriding etc)
@Bharath10121991
@Bharath10121991 5 жыл бұрын
Very nice..... I can't able to watch in Mobile... The letters are very small.... Any other options to view in Mobile?
@bholasinghdhillon7857
@bholasinghdhillon7857 Жыл бұрын
public static void main(String args[]) { String s = "abcd123"; char[] Array1 = s.toCharArray(); char[] Array2 = new char[Array1.length]; char digit; int j=0; for (int i = Array1.length - 1; i >= 0; i--) { digit = Array1[i]; Array2[j]=digit; if(j
@govindagupta7821
@govindagupta7821 5 жыл бұрын
make video for the concept of subArray
@davidparker5530
@davidparker5530 4 жыл бұрын
I would say this solution is generally incorrect because it does not take into account the character encoding of Java (UTF-16). You should preserve the relative ordering of UTF-16 surrogate pairs, i.e. this method fails to correctly reverse a string of code points outside of the basic multilingual plane, c.f. emoji characters. In Java, the StringBuilder/StringBuffer classes already account for this if you use the reverse() method, so your "second" solution would work in this case.
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Yea you are right. Emojii chars can be handled by stringbuffer.
@WriteToProfit
@WriteToProfit 3 жыл бұрын
Naveen sir already tested program output is still there 😜😜
@vinodkumar-yt6te
@vinodkumar-yt6te 6 жыл бұрын
hi naveen, this code available in github ? can share the path
@sunivana-tv
@sunivana-tv 5 жыл бұрын
Thanks!
@namratayadav7721
@namratayadav7721 5 жыл бұрын
HellO how to purchase this course
@kavyak6981
@kavyak6981 5 жыл бұрын
how to reverse the statement Naveen ? india is my country -> o/p to be country my is india // how to do this . all your videos are understandable could you make more videos on prog on java for interview question .
@harikareddy5412
@harikareddy5412 5 жыл бұрын
you can split the statement by spaces and store them into a string array. Then start reading the array data from last index to first using a for loop, take a new string variable and concatenate each word. By end of the for loop execution, new string variable will have the output in the format which you mentioned.
@mariabajwa8632
@mariabajwa8632 6 жыл бұрын
thanks
@krunalsathawane3337
@krunalsathawane3337 2 жыл бұрын
how to reverse the string using junit
@naveenbandi4535
@naveenbandi4535 5 жыл бұрын
"Hai naveen Java" in the given string how to reverse "hai" and "java" keep "naveen" in the same order, can you please write a code for this
@ShinAkuma
@ShinAkuma 3 жыл бұрын
Here's a more efficient method. If you create a String object and keep adding letters to it, it will create n new string objects every time you append a new letter i.e. String rev = ""; rev += "A"; This creates a new object every time you append a letter. Better way is to convert the string into a character array and reverse the array by swapping first and last letters and moving the pointer inwards from both ends, this way you can reverse the string in O(n/2) time. static String reverse(String s) { char[] ar = s.toCharArray(); int l=0; int r=ar.length-1; while(l < r) { char t = ar[l]; ar[l] = ar[r]; ar[r] = t; ++l; --r; } return new String(ar); }
@kalyanijoshi6884
@kalyanijoshi6884 6 жыл бұрын
Please add prime number program too.
@jneeraj2011
@jneeraj2011 6 жыл бұрын
Zooming could help us to see in phone..size is very small
@sai3327
@sai3327 4 жыл бұрын
String s = "Selenium"; String reverse = ""; for (int i = s.length() - 1; i >= 0; i--) { reverse += s.charAt(i); } System.out.println(reverse); why not make the code a bit shorter?
@mariashiny7309
@mariashiny7309 Жыл бұрын
Words are blurred. Not able to view it clearly
@naveenautomationlabs
@naveenautomationlabs Жыл бұрын
You need to change it to HD quality in your KZbin. No issues with the video.
@premsinghrathore9691
@premsinghrathore9691 2 жыл бұрын
String s = "madam", newString = ""; for (int i = s.length() - 1; i >= 0; i--) { newString = newString + s.charAt(i); } System.out.println(newString);
@aura7117
@aura7117 6 жыл бұрын
ok
@Czarkazmx
@Czarkazmx 3 жыл бұрын
It is no longer StringBuffer its StringBuilder
@ashwinib5017
@ashwinib5017 3 жыл бұрын
Both worked for me , StringBuffer and StringBuilder
@aryanpancholi8385
@aryanpancholi8385 5 жыл бұрын
lol.. I made this work within 2 lines.... check it out........... for( int i=(s.length()-1);i>=0;i--){ System.out.print (s.charAt(i)); }
@naveenautomationlabs
@naveenautomationlabs 5 жыл бұрын
Watch the full video, I did the same.
Remove Junk/Special Chars in a String - Java Interview Questions -2
7:30
Naveen AutomationLabs
Рет қаралды 112 М.
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 183 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
How to Reverse an Integer - Java Interview Question -3
11:35
Naveen AutomationLabs
Рет қаралды 110 М.
How to Find Duplicates Elements in Java Array? - Java Interview Questions -5
29:34
Star Pattern Logic - Part 1 - By Naveen AutomationLabs
22:34
Naveen AutomationLabs
Рет қаралды 65 М.
Can we override a static method in child class? || Famous Interview Question
14:46
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,9 МЛН
String Manipulation in Java - Interview questions - Part -7
25:21
Naveen AutomationLabs
Рет қаралды 113 М.
Карина Кросс #shorts
0:16
Dolly and Friends Shorts Cartoons
Рет қаралды 361 М.
The Million view clip on China's Tiktok P2428 #shorts #gochannel
0:15
Go Channel TV
Рет қаралды 29 МЛН
Таким раствором работать одно удовольствие
1:00
Профессия созидатели
Рет қаралды 954 М.
Это лютый угар 🤣 | приколы Арсен Симонян
0:14
Арсен Симонян
Рет қаралды 294 М.
НЕ ДАМ ЕЁ В ОБИДУ😡 #shorts
0:24
Паша Осадчий
Рет қаралды 1,6 МЛН
Её автомобиль никто не хотел ремонтировать!
20:12
Гараж Автоэлектрика
Рет қаралды 1,5 МЛН