I was trying to use StringBuilder to replace my char at 'x' index for "null".. So, let's suppose my input for 'mine' is "<><><>", but I want to replace the index 2(<) and 3(>) for "null", so I would get as output "<><>". The problem is, apparently I can't leave the second argument of sb.setCharAt(2, ''); as '',because I get an error message, so I was wondering what I could do to get the desired output
Scanner sc = new Scanner(System.in);
String mine = sc.next();
StringBuilder sb = new StringBuilder(mine);
sb.setCharAt(2, '');
sb.setCharAt(3, '');
mine = sb.toString();
System.out.println(mine);
sb.deleteCharAt(2);charis a primitive, so what exactly is a nullchar?StringBuilder, for example.