Retranslate the complete English edition from Simplified Chinese (#2010)

* Retranslate the complete English edition from Simplified Chinese

* Polish three English explanations after reader-focused review
This commit is contained in:
Yudong Jin
2026-10-31 03:35:51 +08:00
committed by GitHub
parent ef46e2ed95
commit 14c314c08c
1502 changed files with 29459 additions and 23517 deletions

View File

@@ -10,10 +10,10 @@ import java.util.*;
public class stack {
public static void main(String[] args) {
/* Access top of the stack element */
/* Initialize the stack */
Stack<Integer> stack = new Stack<>();
/* Elements push onto stack */
/* Push elements onto the stack */
stack.push(1);
stack.push(3);
stack.push(2);
@@ -21,20 +21,20 @@ public class stack {
stack.push(4);
System.out.println("Stack stack = " + stack);
/* Return list for printing */
/* Access the top element */
int peek = stack.peek();
System.out.println("Stack top element peek = " + peek);
System.out.println("Top element peek = " + peek);
/* Element pop from stack */
/* Pop an element from the stack */
int pop = stack.pop();
System.out.println("Pop element pop = " + pop + ", after pop, stack = " + stack);
System.out.println("Popped element pop = " + pop + ", after popping, stack = " + stack);
/* Get the length of the stack */
/* Get the stack size */
int size = stack.size();
System.out.println("Stack length size = " + size);
System.out.println("Stack size = " + size);
/* Check if empty */
/* Check whether it is empty */
boolean isEmpty = stack.isEmpty();
System.out.println("Stack is empty = " + isEmpty);
System.out.println("Is the stack empty = " + isEmpty);
}
}