Replacing the last letter of the word with 'java'

How to replace the laster letter of the input word to 'java'

Page 1 of 1

3 Replies - 1713 Views - Last Post: 09 December 2010 - 06:36 AM Rate Topic: -----

#1 Guest_JavaApprentice*


Reputation:

Replacing the last letter of the word with 'java'

Posted 09 December 2010 - 05:57 AM

I need your help in java. I'm just confused about it. I need to input a word & the output should change the last letter of the word to 'java'.
For example:
input: word
output: worjava

thank you in advance.
Is This A Good Question/Topic? 0

Replies To: Replacing the last letter of the word with 'java'

#2 vasdueva  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 141
  • Joined: 03-April 07

Re: Replacing the last letter of the word with 'java'

Posted 09 December 2010 - 06:13 AM

Check out the String api: http://download.orac...ang/String.html

You can use the substring method in a manner like:

if (string.length() >0) {
  string = string.substring(0, string.length()-1);
}

string += "java";


Was This Post Helpful? 1
  • +
  • -

#3 JavaApprentice  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-December 10

Re: Replacing the last letter of the word with 'java'

Posted 09 December 2010 - 06:34 AM

Thank you sir.

This post has been edited by JavaApprentice: 09 December 2010 - 06:38 AM

Was This Post Helpful? 0
  • +
  • -

#4 vasdueva  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 141
  • Joined: 03-April 07

Re: Replacing the last letter of the word with 'java'

Posted 09 December 2010 - 06:36 AM

Sorry no yahoo messenger and might I recommend not posting your email on a public forum.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1