Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.function.Predicate;

public class Main {

    public static void main(String[] args) {
        Predicate<String> a = (input) -> input.contains("a");
        Predicate<String> b = (input) -> input.contains("b");

        System.out.println("test ac:" + a.and(b).test("ac"));
        System.out.println("test bc:" + a.and(b).test("bc"));
        System.out.println("test ab:" + a.and(b).test("ab"));

    }

}