If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h
@kangdysalltag2 жыл бұрын
Hey Alex, I rarely leave comments but I have to say your tutorials are the easiest and coolest way to learn Java! Thank you so much for making these videos. It really helps me a lot to actually gain more interest in programming and not to give up! I love how you make hard things look simple and clear and that really motivates me to keep on going! I also agree on all the comments below that you are amazing! Thanks again!
@lionson52535 жыл бұрын
Thanks for all these vids! I just started learning java and your tutorials are the best out here
@alexlorenlee5 жыл бұрын
that's great to hear, thank you! I'm happy to help
@SimranArora-hp5rq2 ай бұрын
@@alexlorenlee mera ek dout tha apne yeh condition of else ki i-- mai ku nhi lagayi
@SimranArora-hp5rq2 ай бұрын
@@alexlorenlee fir apne i++ mai lagai syso print this and usme use Kiya usme kyu nhi ki i --
@steveejoel32484 жыл бұрын
Bro honestly you are my go to now you explain things at my level of understanding thanks!
@CssSpyxed2 жыл бұрын
I've been learning programming since 2019 and gave up in 2020. Now I'm back and found this channel a while ago, it goes so much better and faster since that. Thank you, Alex, you're amazing!
@thatChillLife20372 жыл бұрын
I just started learning Java a few months ago and I LOVE your tutorials! They explain things so well and you're right, some people learn better by seeing! I just spent 30 min working with how to create a palindrome method online--I took a break and said, let's give videos a try. SO. MUCH. BETTER! Thanks 🙂
@trodg2 жыл бұрын
Hows your coding coming along?
@shauryagaur12625 жыл бұрын
Hi Alex whats upp Though I am a student but still watch your content Lots of support from india
@sospylon58485 жыл бұрын
Good video, maybe in the future you could make a video on program that generates every permutation of an array, i had problems with is lately so i would love to see you explaining it.
@veronicadanu19934 жыл бұрын
You helped me a lot! Thanks Alex, you do a very good job!
@ramonsanchez88153 жыл бұрын
Great work . Explained every step of the way !! Extremely appreciate it
@lathasridhar52993 жыл бұрын
Thank you, this is very helpful for interviews! very nicely explained!
@soniafaizabenchebana31283 жыл бұрын
you are the best alex please keep up the great work !
@justinyao28422 жыл бұрын
bro Alex u should never stop teaching us JAVA
@baran_24513 жыл бұрын
Thank you bro👍🏻
@nerodant855 жыл бұрын
Thank you for the amazing vids Alex, they help a lot.
@RicJiang3 жыл бұрын
U deserve more attention, and many more subscribers! KZbin should pay you more!
@maelstrom573 жыл бұрын
public static boolean isPalindrome(String input) { String reverseInput = ""; for (int i = 0; i < input.length(); i++) reverseInput = input.charAt(i) + reverseInput; if (input.equals(reverseInput)) return true; return false; }
@muhammadnusrum63512 жыл бұрын
So well explained, helped me a lot understanding each statement!
@edwardmallia225 жыл бұрын
Hey Alex I've been watching your vids for a while and I love them. I have a computing project coming up soon that's really important and was wondering if you could do a tutorial on how to use the pop up window and add labels, buttons, lists and stuff like that. Similar to the one of the arrow key detection just with how to use all the different things you can add. Keep up the brilliant work.
@kil97303 жыл бұрын
Wth i understood this so quick man I'm starting from the basics now
@peppermintdior4 жыл бұрын
YOur videos are great really helping me through college ♥ thanks ALEX
@LilyMai07233 жыл бұрын
Thank you Alex you are the best! ♥️
@aaaaaaaaaaaaahhhhhhhhhhhhhhh4 жыл бұрын
You're AMAZING!!!
@ultra_mega_tronic_source3 жыл бұрын
yow, Alex... thanks, bro... I learn so many things from you...
@-------------------2994 жыл бұрын
Very nice video!!
@sultanah55414 жыл бұрын
thanks man, really helped
@efzo3 жыл бұрын
God bless you Alex, you are a legend!!! Thanks for all you do😀
@josephthecreator2 жыл бұрын
Awesome video Alex, thank you.
@JonesJutsu3 жыл бұрын
Hey you saved me some tears
@unofficialbeastx9294 жыл бұрын
Thats you really helped!
@lux27.425 жыл бұрын
good video as always.. thanks :)
@heksqer10225 жыл бұрын
Great video , but couldn't we just compare the strings instead of comparing the characters one by one in a loop ? Say if(original.equals(reverse)){ System.out.println("PALINDROME");}
@alexlorenlee5 жыл бұрын
Tiltproof Meepo yes you could do that too :)
@kcconsigo74294 жыл бұрын
Great tutorial
@sefacorleone82763 жыл бұрын
i ask myself, why you dont just use equals on Strings at the end , beginning with boolean palindrom ? i mean: originalString.equals(reversedString) == palindrom
@NAWAR823 жыл бұрын
it is working, but what about capitalization? how can ignore it?
@sefacorleone82763 жыл бұрын
@@NAWAR82 use .toLowerCase() method on String. Or toUpperCase();
@sefacorleone82763 жыл бұрын
@@NAWAR82 The equalsIgnoreCase() method compares two strings, ignoring lower case and upper case differences. This method returns true if the strings are equal, and false if not. Tip: Use the compareToIgnoreCase() method to compare two strings lexicographically, ignoring case differences. With this its easier and you do not need to loop again. Better for Time and Space complexity.
@Ziggy01203 жыл бұрын
I did this similarly but with the stack and queue data structure
@Tuxedo-Twins3 жыл бұрын
When you have the reverse string can’t we just do equals to check the original and reverse to make the decision on if palindrome true or not
@HoanNguyen-fc8vb4 жыл бұрын
It is very nice.Thank you very much!
@أبوبكرمصطفى-ك4ن4 жыл бұрын
You're awesome ❤️
@jharding324 жыл бұрын
This is only comparing the first and last character. This program would call "YESTERDAY" a palindrome even though it is not. Also, I do not understand why a space made any difference. Can you explain that? The first and last character were still equal.
@negativecreep99713 жыл бұрын
Is it common to see a palindrome problem for the first time, and have no idea how to create a solution?
@zububabu8249 Жыл бұрын
Yes if u don't know about 2 pointers
@mouneibintk95953 жыл бұрын
great explanation
@Reptilectrik273 жыл бұрын
I just dont understand why he has to subsract 1 from "int i = original.length()". Why start at 2 instead of 3?
@-hir0yat0-253 жыл бұрын
Indexing starts at 0 (position 1 = 0, position 2 = 1, position 3 = 2, etc.). So in his example, since there are 3 characters, index 3 doesnt exist, but original.lenght() would return 3 (since there are 3 characters). If he wants to start at the end, index 2 (position 3), he would have to -1 from the length of the original string.
@mahamamjad10863 жыл бұрын
I am not able to understand why there is a minus 1 there
@ChristianAllertse3 жыл бұрын
at the boolean part, why its says "Unreachable code" how do i fix that?
@hiltonvusi74834 жыл бұрын
Thank you Alex🙏
@philipgabrielc.bornea92215 жыл бұрын
Your awesome bro😉
@crazierhiphopbeatzbydegriz57332 жыл бұрын
Great!!! please do also, Data Structures tutorials.
@aalokkumar97323 жыл бұрын
do this question using single for loop
@youvegotmail93852 жыл бұрын
Fantastic!
@gitcat81603 жыл бұрын
What is the difference between .length and .length() in Java
@georgea78503 жыл бұрын
Pseudo code : If user inputs the word and you store in word[] string array.. after conditioning the strlen couldn’t you just read from the End instead of decrement in the loop function?
@sandeepkumar-h8b1w Жыл бұрын
nice and different starategy in teaching and also upload calcualtionpart
@jesussister5954 жыл бұрын
if(reverse.equals(original)) palindrome = true ; why we dont do it like that ? is there something wrong on this?
@a.hao974 жыл бұрын
Yes i used that, it reduced the complexity of the code and it works fine. I tried to use if ( reverse == original) instead and kept getting error messages until i explored using equals..
@coesmetic Жыл бұрын
Why does it print out not a palindrome when i type in 'nurses run' without the 's'?
@archiax1007 Жыл бұрын
My question is why you get a single line saying it's a palindrome or not, but when I use the exact same code it's give me a new line saying it is or isn't when it tests each character? How did I get these loop results to give me the one final line and not multiple lines each time it runs the loop?
@thathsaranibandara32814 жыл бұрын
thank you!
@scottliu60424 жыл бұрын
Can also use original.trim() as well instead of replace, right?
@PinoySinigang4 жыл бұрын
Can anyone help me if you were to put this in a Scanner input?
@optimusprime33404 жыл бұрын
a=s.nextLine();
@adrianpaul81695 жыл бұрын
nice tut.
@shreyak61002 жыл бұрын
Lets go!!
@jeyhunaliyev17653 жыл бұрын
Waiting more java videos but unfortunately no any notifications anymore 🧐
@sarthoknextt51503 жыл бұрын
This is java interview question that i have faced recently..
@takoyaki-sama63373 жыл бұрын
how about when we gotta return true if its a palin. and false if not as a boolean type?
@keeprunning5457 Жыл бұрын
very good excellent!
@OptionsOwnsU3 жыл бұрын
Why iterate again to compare them and not use equals?
@ScylenoMido Жыл бұрын
Saved me 🙏
@rupeshkamble33312 жыл бұрын
What is space and time complexity of this?
@poopass53082 жыл бұрын
savior
@saikiranvaishnav75464 жыл бұрын
Or,instead of another for loop,just compare the original and reverse with if statements.!
@marctan90874 жыл бұрын
Are you using notepad++?
@Ryan-le2im2 жыл бұрын
Thanks x 100
@sabikaali55272 жыл бұрын
if (reverse==original){palindrome = true;} wouldn't this be simpler to do, instead of writing another loop?
@timothybritcliffe2 жыл бұрын
if(original.equals(reverse)){ System.out.println("Is a palindrome!"); } else { System.out.println("Not a palindrome."); That's how you would properly do it. But yes I see what you are getting at
@kvelez Жыл бұрын
Cool program.
@Deepak_mannai3 жыл бұрын
Nice teach
@dirisendiri74252 жыл бұрын
can this program be made in recursion form?
@yasseralkindi73502 жыл бұрын
I did it this way, a few lines of code less, works just fine... public class Palindrome { public static boolean checkPalindrome(String str){ String original = str; String reversed="";//to store reversed str into for (int i= str.length()-1; i>=0; i--) { //starting at the end (length), reversed +=original.charAt(i);//adding char at i (going backwards) if (reversed.equals(original)) { } } return true; } public static void main(String[] args) { String str = "nurses run"; if(checkPalindrome(str)) System.out.println("The string is a palindrome!"); else System.out.println("The string is not a palindrome!"); }}
@christopherkeller29304 жыл бұрын
His keyboard sounds so Juicy
@loicemwai20614 жыл бұрын
😀
@alexsepelenco99024 жыл бұрын
It's not fool proof because of "A Man, a Plan, a Canal - Panama" strings that are not alphabets
@tamannaniger72044 жыл бұрын
Thanks
@samarthvs33383 жыл бұрын
my solution without seeing the video- import java.util.Scanner; class palindrome { static String reverse(String s) { char[] letters = new char[s.length()]; int ind = 0; for(int i = s.length() - 1; i >= 0; i--) { letters[ind] = s.charAt(i); ind++; } String reversed = ""; for(int i = 0; i < s.length(); i++) { reversed = reversed + letters[i]; } return reversed; } static boolean isPalindrome(String str) { if(reverse(str).equals(str)) { return true; } else { return false; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a number:"); String num = sc.nextLine(); if(isPalindrome(num)) { System.out.println(num + " is a palindrome"); } else { System.out.println(num + " is not a palindrome"); } } }
@germescraft3 жыл бұрын
thx
@paia64473 жыл бұрын
System.out.println(palindrome ? "Palindrome" : "Not a Palindrome");
@paia64473 жыл бұрын
It's better to use this than if else statement
@vasilizaitsev72464 жыл бұрын
Great
@TheNEOWOW3 жыл бұрын
int i = word.length() - 1; why -1 here ? index started on 0.. i know but why -1 ?
@poppop-ez9st4 жыл бұрын
hmm u didnt have to do the boolean stuff. Cud have just done a simple if statement to check if it is palindrome. (sry if im wrong :P)
@zane88055 жыл бұрын
bro when you did String reverse = ""; and then reverse += i cringed you shouldve used StringBuffer reverse = new StringBuffer(); and then reverse.append("");
@heksqer10225 жыл бұрын
Why is that better than what's shown in the video ?
@zane88055 жыл бұрын
@@heksqer1022 just is mate
@heksqer10225 жыл бұрын
@@zane8805 so it's not
@anuragtavargiri64114 жыл бұрын
celing gang hold up
@bbftv4952 жыл бұрын
goog
@hellenmarigu7070 Жыл бұрын
Computer is ucked up game circuit
@repentandbelieveinjesus335 жыл бұрын
//user input -aayman shameem
@shitalkevadia55963 жыл бұрын
please try to explain every single detail like instead of telling us ' what' are you creating please go slow and explain 'how " in detail
@timothybritcliffe2 жыл бұрын
correct me if im wrong but couldnt you also do if(original.equals(reverse)){ System.out.println("Is a palindrome!"); } else { System.out.println("Not a palindrome."); to check if the word/phrase is a palindrome?