I wrote a code in java to replace any charecter to a string:
public class NewClass1 {
public static void main(String[] args) {
char ch='D';
String str="laptop";
ch = str + ch;
System.out.println(ch);
}
}
But it gives me error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: java.lang.String cannot be converted to char
at javastackoverflow.NewClass1.main(NewClass1.java:8)
C:\Users\Hp\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)
How can I solve this problem?