1
2package com.journaldev.java8.staticmethod;
3
4public interface MyData {
5
6 default void print(String str) {
7 if (!isNull(str))
8 System.out.println("MyData Print::" + str);
9 }
10
11 static boolean isNull(String str) {
12 System.out.println("Interface Null Check");
13
14 return str == null ? true : "".equals(str) ? true : false;
15 }
16}
17
1
2package com.journaldev.java8.staticmethod;
3
4public class MyDataImpl implements MyData {
5
6 public boolean isNull(String str) {
7 System.out.println("Impl Null Check");
8
9 return str == null ? true : false;
10 }
11
12 public static void main(String args[]){
13 MyDataImpl obj = new MyDataImpl();
14 obj.print("");
15 obj.isNull("abc");
16 }
17}
18