In my program I've created two methods , one with integr type and other with float (line # 20 and 29) !!
class Stack{
int StackArrayI[] = new int[2]; //0,1,2,3,4,5,6,7,8,9
float StackArrayF[] = new float[2]; //0,1,2,3,4,5,6,7,8,9
int tos=-1;
public void push(int value){
if (tos==1)
System.out.print ("Stack already Full..!\n");
else
StackArrayI[++tos] = value; // tos=0
}
public void push(float fvalue){
if (tos==2)
System.out.print ("Stack already Full..!\n");
else
StackArrayF[++tos] = fvalue; // Storing values as Float
}
int pop(){
if (tos==-1){
System.out.print ("Stack is Empty");
return 0;
}
else
return StackArrayI[tos--];
}
float pop(){
if (tos==-1){
System.out.print ("Stack is Empty");
return 0;
}
else
return StackArrayF[tos--];
}
}
but when i'm running a program it is giving an error
Stack1.java:29: pop() is already defined in Stack
float pop(){
^
1 error
Why my program is not working ???