Hi, I'm using netBeans IDE, and I need help with,
| I have the following code, and I want a simple method to print the smallest number in stack, I so beginner so if you can please write a very simple method to me |
class stack1 {
int maxsize,top;
//String arr[];
public int arr[];
int maxsize1;
stack1 (int maxsize){
this.maxsize=maxsize;
arr=new int[maxsize];
top=0;
}
void push (int data) {
if (top<maxsize) {
arr[top]=data;
top++;}
else System.out.print("stack is overflow");
}
void main(String arg[]) {
stack1 s=new stack1(4);
s.push(1);
s.push(10);
s.push(3);
s.push(9);
}
}
I also have a code to display a maxumi