Forums Register Login

Using '\' operator in a string

+Pie Number of slices to send: Send
Hi all

i want to add two strings with '\' parameter between them but it is not working. could someone please help me on this.

Example code:

"Kranthi"+"\"+"Kumar";

this is throwing complier time exception.

Thanks In Advance.

Regards
Kranthi.
+Pie Number of slices to send: Send
got the answer we have to use "\\" insted of "\". Sorry For wating a post.
+Pie Number of slices to send: Send
\ is a special character in Java string literals (used for things like "\n"), so you have to escape it, by using \\.

Alternatively, in this case you could use a char literal rather than a String - so '\'.

Edit: ah, you got it yourself. Good .
What? What, what, what? What what tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 767 times.
Similar Threads
what does synchronised mean in java
calling web service with input soap xml file
Hashtables in WSDL
differences between thows ,throwable,throw
Throw and System.out.println ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:02:03.