Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

" within String

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to use " into String-values:

String a = " he"llo" "

is this the right form:

String a = " he'llo' "
 
Niki Nono
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String a = " he\"llo\" ";

The above will work.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nimo frey wrote:

is this the right form:

String a = " he'llo' "


No, but we have escape sequence to resuce.

So, "he\"llo\"" will work ! Use escape sequence to get there actual meaning in any stream.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic