Java > String-1 > makeTags (CodingBat Solution)


The web is built with HTML strings like "Yay" which draws Yay as italic text. In this example, the "i" tag makes and which surround the word "Yay". Given tag and word strings, create the HTML string with tags around the word, e.g. "Yay".

makeTags("i", "Yay") → "Yay"
makeTags("i", "Hello") → "Hello"
makeTags("cite", "Yay") → "Yay"


public String makeTags(String tag, String word) {
  return "<"+tag+">"+word+"</"+tag+">";

No comments :

Post a Comment

Follow Me

If you like our content, feel free to follow me to stay updated.


Enter your email address:

We hate spam as much as you do.

Upload Material

Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?


Copyright © 2012 - 2014 Java Problems  --  About  --  Attribution  --  Privacy Policy  --  Terms of Use  --  Contact