Write One,Run Everywhere

-------我只想用24个字母、9个数字、下划线_和美圆$编织我心中的图象!

原创  java数据结构之栈 收藏

  1. 栈接口 

    2,栈的实现

    3,节点类型

    4,测试类
    package pku.ss.datastructure.Demo;   
      
    import pku.ss.datastructure.StackLi.StackLi;   
      
    public class StackLiDemo {   
      
        
    /**  
         * 
    @param args  
         
    */
      
        
    public static void main(String[] args) {   
            
    // TODO Auto-generated method stub   
            StackLi stack = new StackLi(5);   
            stack.push(
    "A");   
            stack.push(
    "B");   
            stack.push(
    "C");   
            stack.push(
    "D");   
            stack.push(
    "E");   
            stack.push(
    "F");   
            stack.push(
    "G");   
            stack.push(
    "H");   
            System.out.println(
    "**********************");   
      
            System.out.println(
    "The size of the stack is: " + stack.getSize());   
      
            System.out.println(
    "**********************");   
            System.out.println(
    "The top element of the stack is: " + stack.top());   
      
            System.out.println(
    "**********************");   
            stack.makeEmpty();   
            System.out.println(
    "The top element of the stack is: " + stack.top());   
      
            System.out.println(
    "**********************");   
      
            System.out.println(
    "The size of the stack is: " + stack.getSize());   
        }
       
      
    }
      

发表于 @ 2008年04月22日 14:02:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:JSP彩色验证码  | 新一篇:java数据结构之链表

  • 发表评论
  • 评论内容:
  •  
Copyright © ivorytower
Powered by CSDN Blog