Lambda101-Funcional-interface-1

cleutonsampaio · updated September 24, 2019 · Java
import java.util.*;
import java.lang.*;
import java.io.*;

// Lambda 101: Functional interface

/**
 * Esta eh uma interface funcional, pois possui apenas um metodo abstrato.
 */ 
interface Bhaskara {
 public double delta(double a, double b, double c);
}

class Main {
    public static void main(String[] args) {
        
        // 2x2 + 8x - 24 = 0
        Bhaskara bas = (a,b,c) -> Math.pow(b,2)-4*a*c;
        
        System.out.println(bas.delta(2.0,8.0,-24.0));
    }
}

Comments

Please sign up or log in to contribute to the discussion.