Hi guys, In an exercise on toString() methods in Java, our teacher asks us to write the following method without using StringBuilder : public String toString() { StringBuilder concatchar = new StringBuilder(); if (value >= 2 && (value <= 10){ concatchar.append(value); }else if (value == 11){ concatchar.append("Jack"); }else if (value == 12){ concatchar.append("Queen"); }else if (value == 13){ concatchar.append("King"); }else if (value == 14){ concatchar.append("Ace"); } concatchar.append(" of "); concatchar.append(color.toString()); return concatchar.toString(); } I know I have a problem with the type of my data. But I don't know how to get out of it. In addition, I have to manage several values for 11, 12, 13 and 14. Thanks ;-) What I have tried: <pre>I tried with the "+" operator and the concat() method but without success. Is it possible with "+" or concat() please ? If I try with <pre><pre lang="Java">value + " of " + color.toString()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)