#include <cstdlib>
#include<iostream>
using namespace std;
template <typename T>
class stack
{
public:
T arr[100];
int top;
stack()
{
top=-1;
}
public:
void push(T x)
{
if(top==99)
cout<<"overflow";
else
arr[++top]=x;
}
public :
T pop(void)
{
if(top==-1)
return 0;
else
return arr[top--];
}
};
int main(int argc, char** argv)
{
stack <int> s;
int x;
cout<<"\nEnter no : ";
cin>>x;
s.push(x);
x=s.pop();
cout<<"Element popped : "<<x;
return 0;
}
this is my C++ code for a stack class of variable data type. Its does basic function of pop,push. I want to convert this code to java generics . As i am not very much familiar with java generics . please help me
public class Stack extends Vector{
}
}