자바
[람다함수] 각종 문자 더하고 indexof 구하는 예제
esoesmio
2023. 4. 4. 20:16
String a, b concat 더해라
microsofit+bing의 s 위치 구해라
package april4;
import java.util.Scanner;
public class practice2 {
public static void main(String[] args) {
action((a,b,c)->(a+b).indexOf(c));
action2((a,b)->a+b);
// action((a,b)->{
// String returnstr = b.concat(a);
// return returnstr;
//
// });
// action2((a,b,c)->{
//
// String newstr = a+b;
// return newstr.indexOf(c);
// });
//
//
}
public static void action(customstringg c){
int index = c.indexof("google", "mic", 'c');
System.out.println(index);
}
public static void action2(customstringg2 c){
String result = c.concat("gorgeous ", "gor");
System.out.println(result);
}
}
interface customstringg{
int indexof(String a, String b, char c);
}
interface customstringg2{
String concat(String a, String b);
}