Posts

Showing posts from September, 2023

Java Generics

 public class Parent { public static void main(String[] args){ // generic class constructor  Test<Integer> list = new Test<Integer>(); list.setvalue(12); System.out.println(list.getvalue()); } } class Test<T> { // global variable of type T T objvalue; // method setter  public void setvalue(T objvalue){      this.objvalue = objvalue; } // method getter  public T getvalue(){      return this.objvalue; } } =====================================================  public class Parent { public static void main(String[] args){ // generic class constructor  Test<Integer> list = new Test<Integer>(12); System.out.println(list.getvalue()); } } class Test<T> { // global variable of type T T objvalue; // method setter  public Test(T objvalue){     this.objvalue = objvalue; } // method getter  public T getvalue(){     return this.objvalue; } }

Java List Getter and Setter Methods Managing Data with Java Collections #java

Image
 https://studio.youtube.com/video/Zp8gEo5vPhw/edit