1 2 Previous Next 15 Replies Latest reply: Mar 4, 2010 6:28 AM by 843789 RSS

    Need String program

    843789
      Hi This is Sunil, i'm new to java,
      i wanted one string program i.e.

      Ex: input something like String str = "asdfghjlk";
      wanted output like "asd" , "ahj" and revesre of input..
      please do needful,,,
        • 1. Re: Need String program
          699554
          public static void main(String[] args) {
                    String str = "asdfghjlk";
                    System.out.println("asd");
                    System.out.println("ahj");
                    System.out.println(new StringBuilder(str).reverse());
          }
          Mel
          • 2. Re: Need String program
            843789
            Thank you very much sir....
            • 3. This Thread is now moved
              Darryl Burke
              Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.
              • 4. Re: Need String program
                843789
                can u write this program by using to tostring() method????
                • 5. Re: Need String program
                  699554
                  sunil054 wrote:
                  can u write this program by using to tostring() method????
                  Yes I can madam, can you?

                  Mel
                  • 6. Re: Need String program
                    843789
                    Sir,
                    In above program 1 and 2 output is not taking for input.....
                    how can i write by using tosting() method???
                    • 7. Re: Need String program
                      843789
                      sunil054 wrote:
                      Sir,
                      In above program 1 and 2 output is not taking for input.....
                      how can i write by using tosting() method???
                      @sunil - please do not expect people here to do your homework for you. Forum members will help you fix problems with your homework but if the forum members actually do the homework do you think it is fair that you get a grade that you have not earned?
                      • 8. Re: Need String program
                        843789
                        I'm not excepting anything sir,
                        this program asked in one interview, i didt cleared so wanted output of this program.
                        • 9. Re: Need String program
                          843789
                          sunil054 wrote:
                          I'm not excepting anything sir,
                          this program asked in one interview, i didt cleared so wanted output of this program.
                          This is the 'New To Java' forum so I find it very hard to believe that such a trivial 'Java test' was part of a job interview; even for a very very very junior programmer. It is just the sort of question posted here by students requiring homework solutions.
                          • 10. Re: Need String program
                            Kayaman
                            sunil054 wrote:
                            I'm not excepting anything sir,
                            this program asked in one interview, i didt cleared so wanted output of this program.
                            Maybe you should learn programming before you go to any more interviews?
                            • 11. Re: Need String program
                              843789
                              sabre150 wrote:
                              sunil054 wrote:
                              I'm not excepting anything sir,
                              this program asked in one interview, i didt cleared so wanted output of this program.
                              This is the 'New To Java' forum so I find it very hard to believe that such a trivial 'Java test' was part of a job interview; even for a very very very junior programmer. It is just the sort of question posted here by students requiring homework solutions.
                              No students. Lazy highschool kids calling themselves students maybe, but no students.
                              Students study, that's where the word originates. These kids don't study, they vegetate.
                              • 12. Re: Need String program
                                843789
                                Kayaman wrote:
                                sunil054 wrote:
                                I'm not excepting anything sir,
                                this program asked in one interview, i didt cleared so wanted output of this program.
                                Maybe you should learn programming before you go to any more interviews?
                                No programming required to fill shelves in a supermarket, orders at a fast food joint, or crates of produce on a farm.
                                • 13. Re: Need String program
                                  gimbal2
                                  jwenting wrote:
                                  No students. Lazy highschool kids calling themselves students maybe, but no students.
                                  Students study, that's where the word originates. These kids don't study, they vegetate.
                                  I was no different, I'm hopeful that at least some of them will mature when they reach a certain age, like me. Now if you'll excuse me, I'm missing my favorite cartoons.
                                  • 14. Re: Need String program
                                    843789
                                    gimbal2 wrote:
                                    jwenting wrote:
                                    No students. Lazy highschool kids calling themselves students maybe, but no students.
                                    Students study, that's where the word originates. These kids don't study, they vegetate.
                                    I was no different, I'm hopeful that at least some of them will mature when they reach a certain age, like me. Now if you'll excuse me, I'm missing my favorite cartoons.
                                    I guess that has to be Dilbert :D
                                    1 2 Previous Next