| Author |
how can we assign a text in front text.
|
Dhanushanth Dhanu
Greenhorn
Joined: Jul 10, 2010
Posts: 16
|
|
normally we can add any string through concat behind the text
but my question is how can we add any string in front of the text?
like i need an out put like this "break Helloworld"
please any one give me an answer.
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
|
Did you find any method in the String API? You should try to make your own method.
|
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
String objects are immutable i.e. they are not meant to be modified in the way you want. This is why there are StringBuffer and StringBuilder classes...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Dhanushanth Dhanu
Greenhorn
Joined: Jul 10, 2010
Posts: 16
|
|
Abimaran Kugathasan wrote:Did you find any method in the String API? You should try to make your own method.
no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()
|
 |
Dhanushanth Dhanu
Greenhorn
Joined: Jul 10, 2010
Posts: 16
|
|
Ankit Garg wrote:String objects are immutable i.e. they are not meant to be modified in the way you want. This is why there are StringBuffer and StringBuilder classes...
Yes sir i know that string objects are immutable.so can we do that with StringBuffer or StringBuilder classes? i mean that what i asked above
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Dhanushanth Dhanu wrote:no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()
cancat() isn't a keyword, it's a method of String class. And have a look on this method of StringBuffer class
|
 |
Dhanushanth Dhanu
Greenhorn
Joined: Jul 10, 2010
Posts: 16
|
|
Abimaran Kugathasan wrote:
Dhanushanth Dhanu wrote:no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()
cancat() isn't a keyword, it's a method of String class. And have a look on this method of StringBuffer class
thank you sir.
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
For god's sake don't call me sir
|
 |
Simone Aiello
Greenhorn
Joined: Oct 13, 2010
Posts: 22
|
|
Dhanushanth Dhanu wrote:
normally we can add any string through concat behind the text
but my question is how can we add any string in front of the text?
like i need an out put like this "break Helloworld"
please any one give me an answer.
Did you try with
?
|
The important is not what you know, but when you know it...
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Ankit Garg wrote:For god's sake don't call me sir 
I repeat it!
|
 |
 |
|
|
subject: how can we assign a text in front text.
|
|
|