bgt

PHOTO EMBED

Thu Feb 22 2024 05:40:30 GMT+0000 (Coordinated Universal Time)

Saved by @dsce

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter the values for length, width and depth : ");
        System.out.print(" ");
        int length = scanner.nextInt();
        System.out.print("");
        int width = scanner.nextInt();
        System.out.print(" ");
        int depth = scanner.nextInt();
        Box<Integer, Integer, Integer> box = new Box<>(length, width, depth);
        box.print();
    }
}

class Box<T1, T2, T3> {
    private T1 length;
    private T2 width;
    private T3 depth;

    public Box(T1 length, T2 width, T3 depth) {
        this.length = length;
        this.width = width;
        this.depth = depth;
    }

    public void print() {
        System.out.println("Length : " + length);
        System.out.println("Width : " + width);
        System.out.println("Depth : " + depth);
    }
}










class Box<T1, T2, T3> {
    private T1 length;
    private T2 width;
    private T3 depth;

    public Box(T1 length, T2 width, T3 depth) {
        this.length = length;
        this.width = width;
        this.depth = depth;
    }

    public void print() {
        System.out.println("Length:" + length);
        System.out.println("Width: " + width);
        System.out.println("Depth:" + depth);
    }
}
content_copyCOPY