DemoStack.Java
Java 2016
package Java; public class DemoStack { String[] a = new String[100]; int count = 0; public static void main(String[] args) { DemoStack d = new DemoStack(); d.push("Pika"); d.push("PikaLong"); d.push("PikaChu"); d.pop(); d.display(); } // Them du lieu vao mang public void push(String b) { a[count++] = b; } // Xoa du lieu mang public void pop() { a[count - 1] = a[count--]; } //Hien thi mang public void display() { for (int i = 0; i < count; i++) { System.out.println(a[i]); } } }
0 nhận xét:
Post a Comment