added program 9B
also changed the name of screenshot program 9 to program 9A
This commit is contained in:
18
AreaG.java
Normal file
18
AreaG.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// 9B
|
||||||
|
public class AreaG<T> {
|
||||||
|
private T t;
|
||||||
|
public void add(T t){
|
||||||
|
this.t = t;
|
||||||
|
}
|
||||||
|
public T get() {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
public static void main(String[] args){
|
||||||
|
AreaG<Integer> rectange = new AreaG<Integer>();
|
||||||
|
AreaG<Double> circle = new AreaG<Double>();
|
||||||
|
rectange.add(10);
|
||||||
|
circle.add(2.5);
|
||||||
|
System.out.println(rectange.get());
|
||||||
|
System.out.println(circle.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
BIN
Screenshots/program9B.png
Normal file
BIN
Screenshots/program9B.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
Reference in New Issue
Block a user