Các vấn đề liên quan đến class & interface: 0 Xây dựng class như thế nào? o Tạo object và khởi tạo các giá trị cho các thành phần dữ liệu. o Truy xuất đến thành phần của một object. o Phạm vi truy xuất của các thành phần trong class o Thành phần chung (static) cho tất cả các object của cùng một class. O Mối quan hệ giữa các class & các interf...
25 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 927 | Lượt tải: 0
Tai sao su dụng wrapper class? * Since java is object oriented language in which every single element should be treated as object. * Primitive data types which are not actual objects and we cannot pass them by reference, they are passed by value and also we cannot make two references which refer to same data. * Java only uses these primitive ...
26 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 918 | Lượt tải: 0
class PlayerSprite extends Sprite { private static final int MOVE = 3; private int x,y; private int scnWidth,scnHeight; private int frameWidth, frameHeight; private int frame; private int lives; public PlayerSprite(Image image, int frameWidth, int frameHeight, int scnWidth, int scnHeight) throws Exception { super(image, frameWidth, frameHei...
12 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 948 | Lượt tải: 0
enumerator cung cấp cơ chế lọc (tìm kiếm các record thỏa mãn một điều kiện nào đó). Sử dụng RecordComparator tất cả các record trong RecordStore đều được lưu trong một result set. Dùng RecordFilter, thỏa điều kiện mới trong enumerator result set. class SearchFilter implements RecordFilter {private String searchText = null;public SearchFilter(Str...
30 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 944 | Lượt tải: 0
Các phương thức của giao diện này: getLevel() Lấy âm lượng ở mức hiện tại, giá trị trả về là kiểu int. getMuted() Lấy trạng thái mute của tín hiêu liên quan đến VolumeControl này, giá trị trả về là kiểu boolean. setLevel(int level) Đặt âm lượng sử dụng các giá trị từ 0 đến100; setMute(boolean mute)Thiết lâp trạng thái mute hoặc unmute.
17 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 935 | Lượt tải: 0
TiledLayer(int columns, int rows, Image image, int tileWidth, int tileHeight); Có số hàng, cột và ảnh cần chia. Độ rộng và cao của tile setCell(int col, int row, int tileIndex);//đặt tile vào bức ảnh ở vị trí col,row và lấy ảnh có tileIndex (ở trên là từ 1,2, 6) getCell(int col, int row);//trả về index của cell, nếu cell là empty trả về 0 ...
34 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 910 | Lượt tải: 0
Một Alert đơn giản là một hộp thoại rất nhỏ. Có 2 loại Alert: • Modal: hộp thoại thông báo được trình bày đến khi người dùng ấn nút đồng ý • Non-modal: hộp thoại thông báo chỉ được trình bày trong một số giây nhất địnhCác phương thức dựng của Alert:Alert(String title)Alert(String title, String alertText, Image alertImage, AlertType alertType)...
26 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1169 | Lượt tải: 0
It is important to note that a generic class is
shared by all its instances regardless of its
actual generic type.
GenericStack
16 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 911 | Lượt tải: 0
1. It begins with an equilateral triangle, which is considered to be the Sierpinski fractal of order (or level) 0, as shown in Figure 19.7(a). 2. Connect the midpoints of the sides of the triangle of order 0 to create a Sierpinski triangle of order 1, as shown in Figure 19.7(b). 3. Leave the center triangle intact. Connect the midpoints of th...
43 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 959 | Lượt tải: 0
RandomAccessFile Methods, cont. long length()IOException Returns the length of the file. final void writeChar(int v) throws IOException Writes a character to the file as a two-byte Unicode, with the high byte written first. final void writeChars(String s) throws IOException Writes a string to the file as a sequence of characters
37 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1038 | Lượt tải: 0