Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.8 kB
1
Indexable
Never
package com.jb.sb102;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@SpringBootApplication
public class Sb102Application {

	public static void main(String[] args) {
		// SpringApplication.run(Sb102Application.class, args);

		GenTest<A, C> genTest = new GenTest<A, C>(new A(), new C());
		genTest.display();

	}
	static class GenTest <T extends BImpl & B, U extends DImpl & D>{
		T objT;
		U objU;

		public GenTest(T objT, U objU) {
			this.objT = objT;
			this.objU = objU;
		}
		public void display() {
			this.objT.printerP1();
			this.objT.starterP1();
			this.objU.printerP2();
			this.objU.starterP2();
		}
	}

	static class A extends BImpl {
		String str = "Test";
		public void printerP1() {
			System.out.println("Inside A.");
		}


	}

	static class BImpl implements B{

		@Override
		public void starterP1() {
			System.out.println("Inside BImpl starter.");
		}
	}

	interface B {
		void starterP1();
	}
	static class AA extends BImpl implements B{

		@Override
		public void starterP1() {
			System.out.println("Inside AA starter.");
		}
	}
	static class CC extends A{
	}
	static class C extends DImpl {
		public void printerP2() {
			System.out.println("Inside DImpl.");
		}
	}

	static class DD extends DImpl implements D {
		@Override
		public void starterP2() {
			System.out.println("Inside DD starter.");
		}
	}

	static class DImpl implements D{
		@Override
		public void starterP2() {
			System.out.println("Inside E starter.");
		}
	}
	interface D {
		public void starterP2();
	}

	static class FF extends C{
	}
}