Palindrome Program in Java | Interview questions and answers for freshers | Part 1

Поділитися
Вставка
  • Опубліковано 19 жов 2024

КОМЕНТАРІ • 34

  • @ABCforTechnologyTraining
    @ABCforTechnologyTraining  5 років тому +2

    Learn from Leaders, Learn from ABC.
    Watch our latest technical videos in your language:
    For Hindi:- bit.ly/2TRuGVP
    For Kannada:- bit.ly/31NH63M
    For Telugu:- bit.ly/2MuYRRP
    For Tamil:- bit.ly/2Num5Hz

    • @Name-xv9un
      @Name-xv9un 4 роки тому

      How much tuition for online training?

  • @dmitriywhite8279
    @dmitriywhite8279 5 років тому +14

    Hi from Russia! Your way to teaching is great! But for that task it is better to use another algoithm:
    for (int i = 0; i < charsLength/ 2; i++) {
    if (chars[i] != chars[charsLength -1 -i]) {
    isPalindrome = false;
    break;
    }
    }
    You shouldn't create second array, just iterate through your source chars.

    • @bingbongthearcher2225
      @bingbongthearcher2225 4 роки тому +1

      Hi frOm GeRmAnY
      why not:
      "returntype" checkPalindrome(String word) {
      return word.equals(reverse(word));
      //zack fertich

  • @barath1710
    @barath1710 4 роки тому

    Hi, ur explanation is too good to understand i am so poor when it comes to logics and i am worried can i really able to write logics on my own but now after seeing ur videos i got confidence

  • @RaviGuptaJB
    @RaviGuptaJB 5 років тому +4

    Keep making video like this sir. It's really awesome. And do making video which helps us to enhance skill. Thank you, sir.

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому +1

      Hello Ravi Kumar
      Thanks for your valuable feedback and support.
      If you are new, Please subscribe to get updates about new videos in the following link:
      x.co/fresher

    • @mulasivajyothi8169
      @mulasivajyothi8169 4 роки тому

      This is awesome teaching sir we won't codeing in angular sir please post it also

  • @gauthamalva8701
    @gauthamalva8701 4 роки тому

    It is really helpful sir..Loved your way of explaining things .Now iam able to solve interview string questions...
    Hope I'll get some more videos on other data Structures..

  • @shubhamsinghbhadoria3807
    @shubhamsinghbhadoria3807 5 років тому

    Really helpful 🙌
    Your Way of teaching is different which awesome 👍

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому

      Thank you for recognizing my contribution. We really appreciate your kind words and encouragement. Happy learning, Shubham!

  • @santhoshivempati9757
    @santhoshivempati9757 5 років тому

    Awesome video n explanation👏👏👏👌👌👌 sir thank you soo much..

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому +1

      We all put in a lot of effort; thank you for acknowledging our hard work. Happy learning, Santhoshi Vempati!

  • @likhithpolarc6118
    @likhithpolarc6118 5 років тому +2

    class palindrome
    {
    public static void main(String[] args)
    {
    String x="level";
    char y[]=x.toCharArray();
    int size =y.length;
    char a[]=new char[size];
    int i=0;
    while(i!=size)
    {
    a[size-1-i]=y[i];
    ++i;
    }
    i=0;
    while(i!=size)
    {
    if(a[i]!=y[i])
    {
    System.out.println("not palindrome");
    System.exit(0);
    }
    else
    {
    ++i;
    continue;
    }
    System.out.println("palindrome");
    }
    }
    }
    sir
    no error while compailing but not showing output .
    clear me sir.

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому

      You have missed the closing braces after while loop. Also there's no other statement after "continue" within the loop, hence there's no need to use "continue". Hope this would clarify your doubt.

  • @Name-xv9un
    @Name-xv9un 4 роки тому

    Great job I love the algorithms explanation

  • @chandan6641
    @chandan6641 5 років тому

    Hai sir,
    Plz do explain why continue statement is used here.
    Thank you!

    • @MahendraKumar-pf8wj
      @MahendraKumar-pf8wj 5 років тому

      continue statement not necessary here, only ++i or i++ would do fine!
      but for the matter of fact continue keyword skips all the following statements in the current iteration but "continues" with the next iteration

  • @naveenkamath2882
    @naveenkamath2882 4 роки тому

    why did we write SOP(" palindrome") after the end of while loop;
    For Example : if the word is " civic " then it will print palindrome
    but if we print word like "civisc" , Then it will print something like this :
    non palindrome
    is palindrome
    plz help
    String name ="cisvic";
    char [] a=name.toCharArray() ;
    int n = a.length;
    char [] b = new char[n];
    int i=0;
    while(i

  • @anavaratha7020
    @anavaratha7020 5 років тому

    Sir.. y can't we write code second p
    While block in frst while block only and y u have used else part with continue.

  • @deeptijha4850
    @deeptijha4850 5 років тому +1

    sir ,why we write public before the class.

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому +1

      Access Modifiers help restrict the scope of programming elements such as variables, methods, constructors and classes. Addressing your query, If a class is declared as "public" then it can be accessed from anywhere within a project. So if you're sure that a particular class will not be accessed anywhere else, then it's not mandatory to declare the class as "public". You can either have "no modifier" (default - package specific) or have "public" modifier. However please note within a given Java file, there cannot be more than one public class defined.

    • @deeptijha4850
      @deeptijha4850 5 років тому

      @@ABCforTechnologyTraining thanq sir

  • @AMANSAINI-iy8fb
    @AMANSAINI-iy8fb 4 роки тому

    Can’t we just use equals after reversing string and storing into other variable ??

    • @sidharthmandal9957
      @sidharthmandal9957 4 роки тому

      yes, we can..just use boolean result = arrays.equals(a,b);......................if true then pallindrome , if not then not a pallindrome

  • @nikhiln9899
    @nikhiln9899 5 років тому

    its working only for non palindrome.. and for palindrome it's showing that it is terminated...

  • @bhavyashetty8682
    @bhavyashetty8682 5 років тому +1

    way of explaination is nice.

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому

      Hi Bhavya
      Thank you for appreciating our work. We are glad to have helped. Do check out our other tutorial videos and subscribe to us to stay connected. :)
      x.co/fresher

  • @deeptijha4850
    @deeptijha4850 5 років тому

    Palindrome1.java:7: error: cannot find symbol
    int size=y.lenght;
    ^
    symbol: variable lenght
    location: variable y of type char[]
    1 error
    sir ,when i code this program this error will come in compile time.

    • @ABCforTechnologyTraining
      @ABCforTechnologyTraining  5 років тому +2

      You have misspelled "length" as "lenght". Rectify this and that will fix the error.

  • @sagarchavadi6599
    @sagarchavadi6599 5 років тому

    Prgm not executing and output console isn't displaying