class Size<T> {
public T width;
public T height;
public Size(T width, T height) {
this.width = width;
this.height = height;
}
public String asText() {
return String.format("[%s; %s]", width, height);
}
}
var sizeInt = new Size<Integer>(5, 8);
var textInt = sizeInt.asText();
//textInt is "[5; 8]"
var sizeFloat = new Size<Float>(3.7f, 1.58f);
var textFloat = sizeFloat.asText();
//textFloat is "[3.7; 1.58]"
System.out.println("textInt is " + textInt);
System.out.println("textFloat is " + textFloat);