public class Tester { public static void main(String[] args) { String s = ""; Integer x = 5; StringBuffer sb = ""; if (x < 0) s.concat("javachamp"); else sb.append("javachamp"); System.out.print(s + sb); } }
public static void main(String[] args) {
String s = "";
Integer x = 5;
StringBuffer sb = "";
if (x < 0)
s.concat("javachamp");
else
sb.append("javachamp");
System.out.print(s + sb);
}
StringBuffer cannot be instantiated and initialized this way
Oracle Certified Professional Java Programmer
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.