Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. public class Pila {
  3. int array[]= new int[5];
  4.  
  5. Pila() {
  6. this.array[0] = 0;
  7. this.array[1] = 0;
  8. this.array[2] = 0;
  9. this.array[3] = 0;
  10. this.array[4] = 0;
  11. }
  12.  
  13. void estrazione(int a) {
  14. for(int i=0;i<4;i++) {
  15. this.array[i]=this.array[i+1];
  16. }
  17. this.array[4]=0;
  18. }
  19.  
  20. void inserimento(int i) {
  21. for(int i=0; i<4)
  22. }
  23.  
  24. public static void main(String[] args) {
  25. Pila pila=new Pila();
  26. for(int i=0;i<5;i++) {
  27. System.out.println(pila.array[i]);
  28. }
  29. pila.estrazione(4);
  30. pila.inserimento(4,15);
  31. for(int i=0;i<5;i++) {
  32. System.out.println(pila.array[i]);
  33. }
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement