Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Can any one have some logic for this problem?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    My Mood
    Amused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can any one have some logic for this problem?

    Dear Friends,
    I'm new to this group and this is my first post. So I have a very simple problem. Please give your valuable suggestion.
    Problem is:
    String name ="Hello and Hello Java";
    I want to replace the last occurrence of Hello in the above line. So the input string can be any line and replace text be any text? Please post your suggestion.
    Regards,
    Rakesh Verma
    09017319907


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Can any one have some logic for this problem?

    1. Welcome to Java Programming forums.
    2. Read Java Programming Forums - The Java Community - Official Forum Rules
    3. What have you tried?

  3. #3
    Member
    Join Date
    Dec 2011
    Posts
    48
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Can any one have some logic for this problem?

    Unless you are practising basic java language constructs, the normal approach would be to..

    1. Decide which data type(s) is central to the problem.

    2. Find the class or classes within the Java language or API that deal with that data type.

    3. Select candidate methods that support or solve parts of the problem.

    4. Combine the methods with your own logic.

    Try that, and let us know which class and methods you have selected.

    If you get stuck come and ask more questions :-)

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    28
    My Mood
    Busy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can any one have some logic for this problem?

    Quote Originally Posted by verma86 View Post
    Dear Friends,
    I'm new to this group and this is my first post. So I have a very simple problem. Please give your valuable suggestion.
    Problem is:
    String name ="Hello and Hello Java";
    I want to replace the last occurrence of Hello in the above line. So the input string can be any line and replace text be any text? Please post your suggestion.
    Regards,
    Rakesh Verma
    09017319907
    Hello Rakesh !

    Below is the code i have written it for you.......Hope it meets your requirement.



    ...edited by moderator

    Let me know if you require any changes....Happy coding
    Last edited by copeg; December 13th, 2011 at 08:40 AM.

  5. #5
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: Can any one have some logic for this problem?


  6. The Following User Says Thank You to Tjstretch For This Useful Post:

    copeg (December 13th, 2011)

  7. #6
    Junior Member
    Join Date
    Jul 2011
    Posts
    28
    My Mood
    Busy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can any one have some logic for this problem?

    Quote Originally Posted by Tjstretch View Post
    I am extremely Sorry......

  8. #7
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,335
    Thanks
    181
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: Can any one have some logic for this problem?

    Quote Originally Posted by rohan22 View Post
    I am extremely Sorry......
    Please also read the forum rules. I have removed the code from your post.

Similar Threads

  1. need logic
    By arunjib in forum Java Theory & Questions
    Replies: 3
    Last Post: November 27th, 2011, 04:39 PM
  2. Problem with the Logic
    By sudh in forum Java Theory & Questions
    Replies: 4
    Last Post: March 31st, 2011, 07:21 AM
  3. whats logic behind this?
    By X0X0 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 26th, 2011, 01:48 PM
  4. Help with java logic
    By dever in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 7th, 2011, 07:41 AM