java code for stack let' examine programstack javathat implements stack using class called stackx listing contains this class and short main(routine to exercise it listing the stack java program /stack java /demonstrates stacks /to run this programc>java stackapp import java io */for / ///////////////////////////////////////////////////////////////class stackx private int maxsize/size of stack array private double[stackarrayprivate int top/top of stack //public stackx(int /constructor maxsize /set array size stackarray new double[maxsize]/create array top - /no items yet //public void push(double /put item on top of stack stackarray[++topj/increment topinsert item //public double pop(/take item from top of stack return stackarray[top--]/access itemdecrement top //public double peek(/peek at top of stack return stackarray[top]//public boolean isempty(/true if stack is empty