Super Utility 1 ArrayList linked list

Source: Internet
Author: User

1  PackageArrayList linked list;2 ImportJava.util.*;3  Public classKK1 {4 5     /**6 * Mr.fan7 * Function: Remember ArrayList linked list8      */9      Public Static voidMain (string[] args) {Ten         //TODO auto-generated Method Stub OneArrayList al=NewArrayList (); ASystem.out.println ("Al size:" +al.size ()); -Clerk clerk1=NewClerk ("Song Jiang", 50,1000); -Clerk Clerk2=NewClerk ("Wu use", 45,1200); theClerk clerk3=NewClerk ("Lin", 45,1400); - Al.add (CLERK1); - Al.add (CLERK2); - Al.add (CLERK3); +System.out.println ("Al size:" +al.size ()); -          for(intI=0;i<al.size (); i++) +         { AClerk temp= (Clerk) Al.get (i);//Here I refers to the address in the linked list, pointing to the atSystem.out.println ("name =" +temp.getname ()); -         } -         //Delete an object -Al.remove (1); -System.out.println ("++++++++++++ delete Wu with ++++++++++++++++++"); -          for(intI=0;i<al.size (); i++) in         { -Clerk temp= (Clerk) Al.get (i);//Here I refers to the address in the linked list, pointing to the toSystem.out.println ("name =" +temp.getname ()); +         } -          the     } *  $ }Panax Notoginseng classClerk - { the  +     PrivateString name; A     Private intAge ; the     Private floatSal; +      PublicClerk (String name,intAgefloatSal) -     { $          This. name=name; $          This. age=Age ; -          This. sal=Sal; -     } the      PublicString GetName () { -         returnname;Wuyi     } the      Public voidsetName (String name) { -          This. Name =name; Wu     } -      Public intGetage () { About         returnAge ; $     } -      Public voidSetage (intAge ) { -          This. Age =Age ; -     } A      Public floatgetsal () { +         returnSal; the     } -      Public voidSetsal (floatSal) { $          This. Sal =Sal; the     } the}

Super Utility 1 ArrayList linked list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.