Java Code - Appostrophe (most likely spelled wrong)

In the code found below, Can someon tell me what the apostrophe is used for? What is its purpose?

resp = resp + "<BusinessName id='"+BusinessId+"'>"+BusinessName+"</BusinessName>";
Who is Participating?
"<BusinessName id='"+BusinessId+"'>"+BusinessName+"</BusinessName>"
"<BusinessName id='1'>Sample Business Name</BusinessName>"

resp = resp -- indicates concatenation with older entry present in resp
+ -- concatenate
"<BusinessName id='" -- This will indicate one string
+ -- concatenate
BusinessId -- The business Id to be used
+ -- concatenate
"'>" -- one more part of the string
+ -- concatenate
BusinessName -- The business name
+ -- concatenate

So a string would be inside ""

now we have

"<BusinessName id='" -- a single quote after the equals sign/ apostrophe
"'>" -- similarly here
This is used because id is an attribute of the BusinessName and all XML attribute values must be quoted
like id='1' or id = "1"

if we need to add "" double quotes we need to escape it with \
"<BusinessName id=\""+BusinessId+"\">"+BusinessName+"</BusinessName>"

hence the above snytax.

Hope this is clear.
Sathish David Kumar NArchitectCommented:
think  initialzly resp=5

now as ur give
ur going to assign new value to resp !!

resp + "<BusinessName id='"+BusinessId+"'>"+BusinessName+"</BusinessName>";
+  for concatenate the strings ..

<BusinessName>  tag ur  using !!
</BusinessName> close the tag !!

property is id

u want to assign string value to id ..

so ' " +BusinessId+" '  

gazdzidAuthor Commented:
I would like to review before assigning points. sorry for the delay
gazdzidAuthor Commented:
I agree with moderator.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.