Created
March 20, 2020 14:40
-
-
Save TanjinAlam/bdf809150ca244349f0e7dd433aa2c2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Interface Class | |
package javaapplication1; | |
import java.util.ArrayList; | |
public interface In1 { | |
final static ArrayList<Integer> arrli = new ArrayList<Integer>(); | |
} | |
//first class | |
package javaapplication1; | |
import java.util.ArrayList; | |
public class JavaApplication1 implements In1 { | |
public static void main(String[] args) { | |
arrli.add(1); | |
arrli.add(2); | |
} | |
} | |
//second class | |
package javaapplication1; | |
public class NewClass implements In1{ | |
public static void main(String[] args) { | |
arrli.add(3); | |
} | |
} | |
//third class | |
package javaapplication1; | |
import static javaapplication1.In1.arrli; | |
public class NewClass1 extends NewClass { | |
public static void main(String[] args) { | |
arrli.add(4); | |
for(int i=0; i<arrli.size(); i++) | |
{ | |
System.out.println(arrli.get(i)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment