1 / 20

การใช้ ArrayList

การใช้ ArrayList. พิมพ์ Arr แล้วกด Ctrl+Spacebar. ArrayList <Integer> data = new ArrayList <Integer>(); <Integer> เป็นการระบุชนิดของข้อมูลที่จะเก็บใน ArrayList ถ้าไม่ระบุจะเก็บได้ทุกอย่าง. การใช้ Collections. พิมพ์ Coll แล้วกด Ctrl+Spacebar.

len-horn
Télécharger la présentation

การใช้ ArrayList

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. การใช้ ArrayList พิมพ์ Arrแล้วกด Ctrl+Spacebar ArrayList<Integer> data = new ArrayList<Integer>(); <Integer> เป็นการระบุชนิดของข้อมูลที่จะเก็บใน ArrayListถ้าไม่ระบุจะเก็บได้ทุกอย่าง

  2. การใช้ Collections พิมพ์ Collแล้วกด Ctrl+Spacebar Collections เป็น class ที่ใช้จัดการข้อมูลใน List sort จะเรียงจากน้อยไปมาก

  3. สร้าง class เพื่อ Comparator สำหรับควบคุมการ Sort

  4. การใช้ Comparator พิมพ์ My แล้วกด Ctrl+Spacebar Comparator เป็น Interface เพื่อใช้ระบุวิธีการ เปรียบเทียบสมาชิกใน Collection

  5. การใช้ Collections : shuffle สุ่มไพ่ พิมพ์ Link แล้วกด Ctrl+Spacebar poll( ) จะเป็นการเอาสมาชิกตัวแรกออกจาก List

  6. การอ่านข้อมูลจาก text ไฟล์ แสดง Error เมื่อเปิดไฟล์ไม่ได้

  7. การอ่านข้อมูลจาก text ไฟล์ แบบฝึกหัด 1. แก้ไขโปรแกรมเพื่อแสดงผลรวมข้อมูล 2. แก้ไขโปรแกรมให้ เรียงลำดับข้อมูล

  8. อ่านข้อมูลจาก WWW http://game.devtrainer.net/data.php

  9. การใช้ Class URL

  10. JFrame การทำ GUI

  11. แสดงภาพ icon จากเว็บ

  12. เกมส์สุ่มไพ่ http://game.devtrainer.net/img/cards.png

  13. 1. สร้าง class Card

  14. 1. สร้าง class Card ใช้ Generate Constructor

  15. 1. สร้าง class Card

  16. 2. ทดสอบแสดงไพ่

  17. แบบฝึกหัด เขียนโปรแกรมเพื่อสุ่มเลือกไพ่จากสำรับ มาแสดงจำนวน 4 แถว แถวละ 5 ใบ

More Related