Create a Java program to demonstrate the use of an interface with a private static method
interface MathUtils { static int add(int a, int b) { return a + b; } private static int multiply(int a, int b) { return a * b; } default int addAndMultiply(int a, int b) { return add(a, b) + multiply(a, b); } } public class Main { public static void main(String[] args) { MathUtils math = new MathUtils() {}; System.out.println("Result : " + math.addAndMultiply(5, 6)); } }
Result : 41
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions