Stringbuilder demo video

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
The method setCharAt(int, char) in the type AbstractStringBuilder is not applicable for the arguments (int, String)

at StringNStringBuilder.StringBuilderDemo.main(StringBuilderDemo.java:10)

when i run line given below
System.out.println(sb.setCharAt(2,“W”));

the error is coming which is stated above

@Naman_Gupta,

Instead of "W" use 'W' because "W" is read as a string while 'W' is read as a char. And setCharAt(int,char) takes input in the form of int and char not int and string.

If you face any further doubt, attach your complete code :smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.