될때까지 외우기

[람다] 문자열 두개 받아서 비교하는거

esoesmio 2023. 4. 4. 18:39

문자열 두개 받아서 비교해라 인터페이스써서

package april4;

import java.util.Scanner;

public class practice2 {
    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        String z = sc.nextLine();
        String x = sc.nextLine();
compp(String::equals,z,x);


    }

    public static void compp(compare c, String a, String b){

        System.out.println(c.com(a,b));

    }


}


interface  compare{

public boolean com(String a, String b);

}