Skip to main content

문자열 결합_String indexof

#


#

import java.util.Scanner;

 

public class ChangeString {

 

public static void main(String[] args) {

// TODO Auto-generated method stub

String name = "i love u";

int change = name.indexOf("love");

String name1 = "u";

Scanner scan = new Scanner(System.in);

System.out.println(name + "입력하세요 : ");

scan.nextLine();

name = name.substring(0, change) +"hate";

System.out.println(name +" "+ name1);

 

}

 

}



#


Comments