Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test{
- public static void main(String[] args){
- String guess = "Colin is so great!";
- System.out.println(guess);
- guess = setCharAt(guess,1,'c');
- guess = setCharAt(guess,8,'X');
- System.out.print(guess);
- }
- public static String setCharAt(String s, int i, char c){
- return s.substring(0,i) + c + s.substring(i+1);
- }
- }
- makes output:
- Colin is so great!
- Cclin isXso great!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement