Hiding Fields and Static Methods, cont. When invoking an instance method from a reference variable, the actual class of the object referenced by the variable decides which implementation of the method is used at runtime. When accessing a field or a static method, the declared type of the reference variable decides which method is used at comp...
56 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 992 | Lượt tải: 0
Sử dụng chương trình duyệt Web c.Làm việc với form Forms là một hình thức trên Web cho phép thực hiện việc trao đổi thông tin giữa người sử dụng chương trình duyệt và chương trình Server. Các thành phần có thể thấy trên một form là: Hộp soạn thảo (textbox). Hộp chứa danh sách các lựa chọn. Các nút tròn chọn một. Các hộp đánh dấ...
14 trang | Chia sẻ: thucuc2301 | Ngày: 23/11/2020 | Lượt xem: 895 | Lượt tải: 0
Write a class named ReplaceText that replaces a string in a text file with a new string. The filename and strings are passed as command-line arguments as follows: java ReplaceText sourceFile targetFile oldString newString For example, invoking java ReplaceText FormatString.java t.txt StringBuilder StringBuffer replaces all the occurrences of ...
52 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1071 | Lượt tải: 0
Creating Windows Using the JFrame Class Objective: Demonstrate using classes from the Java library. Use the JFrame class in the javax.swing package to create two frames; use the methods in the JFrame class to set the title, size and location of the frames and to display the frames.
58 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 978 | Lượt tải: 0
Objective: write a program that calculates the total score for students in a class. Suppose the scores are stored in a threedimensional array named scores. The first index in scores refers to a student, the second refers to an exam, and the third refers to the part of the exam. Suppose there are 7 students, 5 exams, and each exam has two parts-...
40 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1180 | Lượt tải: 0
There are two ways to use classes from a package. • One way is to use the fully qualified name of the class. For example, the fully qualified name for JOptionPane is javax.swing.JOptionPane. For Format in the preceding example, it is com.prenhall.mypackage.Format. This is convenient if the class is used a few times in the program. • The other ...
37 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 966 | Lượt tải: 0
Xóa thư trong chương trình Mail Client Để xóa thư không cần xem nữa trong hầu hết các chương trình Mail client bạn có thể nhấp chuột trên lá thư đó và nhấn nút Delete. Thư vừa xóa sẽ đưa vào trong Deleted Items folder, muốn xóa hẳn phải thực hiện xóa một lần nữa trong folder này Thực hành Sử dụng email mail.tuyenquang.edu.vn. Đăng kí...
16 trang | Chia sẻ: thucuc2301 | Ngày: 23/11/2020 | Lượt xem: 839 | Lượt tải: 0
Example: Displaying Prime Numbers Problem: Write a program that displays the first 50 prime numbers in five lines, each of which contains 10 numbers. An integer greater than 1 is prime if its only positive divisor is 1 or itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. Solution: The problem can be broken into...
17 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 981 | Lượt tải: 0
Hệ thống tên miền - DNS DNS cũng được chia làm nhiều phần, mỗi phần cũng phân cách bằng dấu chấm. Một cách tổng quát Domain name có dạng: tên-host.tên-mức-hai.tên mức một (hostname.second-level.first-level) Tên-mức-một: chỉ ra kiểu tổ chức hoặc quốc gia mà host nằm trong đó. Tên-mức-hai: chỉ ra tên tổ chức làm chủ và điều hành mạng m...
26 trang | Chia sẻ: thucuc2301 | Ngày: 23/11/2020 | Lượt xem: 898 | Lượt tải: 0
Formatting Output Use the new JDK 1.5 printf statement. System.out.printf(format, items); Where format is a string that may consist of substrings and format specifiers. A format specifier specifies how an item should be displayed. An item may be a numeric value, character, boolean value, or a string. Each specifier begins with a percent sign
20 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 933 | Lượt tải: 0