• Non ci sono risultati.

17 return stk.length

N/A
N/A
Protected

Academic year: 2021

Condividi "17 return stk.length"

Copied!
1
0
0

Testo completo

(1)

ArrayStack.java 1

2public class ArrayStack { 3

4 private final static int SIZE = 10;

5 private int[] stk;

6 private int top = -1;

7

8 ArrayStack() {

9 stk = new int[SIZE];

10 }

11

12 ArrayStack(int l) { 13 stk = new int[l];

14 }

15

16 public int lunghezza () { 17 return stk.length;

18 }

19

20 public void push (int v) { //inserisce un intero in cima alla pila

21 top = top + 1;

22 stk[top] = v;

23 }

24

25 public int pop () { //estrae l'elemento in cima alla pila (e lo restituisce)

26 top = top - 1;

27 return stk[top + 1];

28 }

29 30 31 } 32

Page 1

Riferimenti

Documenti correlati

- un metodo che restituisce una stringa che descrive un volo non diretto tramite sigla del volo, citt`a e nome dell’aereoporto di partenza, citt`a e nome dell’aereoporto di

Scrivere un metodo che, data una matrice di interi, restituisce true se gli ele- menti sul bordo esterno della matrice sono tutti uguali, false altrimenti.. Scrivere un metodo

Ufficio dei referenti per la formazione decentrata

Considerata altresì la più recente attività e gli strumenti sviluppati dall’Assemblea e dalla Giunta regionale sui temi della Qualità della legislazione (il

[r]

or parameter values regarded as decisive, such as the attainment of 80% of the force capacity of the contra-lateral limb, measurement of thigh circumfer- ence, or joint mobility,

cannot fully specify interpretation of sentences because non-logical symbols reach outside the

Ictal or interictal single-photon emission tomography (SPECT) evaluation of regional cerebral blood flow (rCBF) with tracers such as Tc-99m hexamethylpropylene (Tc-99m HMPAO) and