✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Quelle est la sortie de ce programme (Pile générique)?
import java.util.Stack;
class Pilegeneric <E>
{
Stack <E> pile = new Stack <E>();
public void push(E obj)
{
pile.push(obj);
}
public E pop()
{
E obj = pile.pop();
return obj;
}
}
public class Test
{
public static void main(String args[])
{
PileGeneric <String> p1 = new PileGeneric <>();
p1.push("Hello");
System.out.print(p1.pop() + " ");
PileGeneric <Integer> p2 = new PileGeneric <>();
p2.push("44");
System.out.println(p2.pop());
}
}