• Introduction to Java Programming - Chapter 7: Objects and ClassesIntroduction to Java Programming - Chapter 7: Objects and Classes

    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.

    pdf58 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 978 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 6: ArraysIntroduction to Java Programming - Chapter 6: Arrays

    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-...

    pdf40 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1179 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 5: MethodsIntroduction to Java Programming - Chapter 5: Methods

    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 ...

    pdf37 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 966 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 4: LoopsIntroduction to Java Programming - Chapter 4: Loops

    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...

    pdf17 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 981 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 3: Control StatementsIntroduction to Java Programming - Chapter 3: Control Statements

    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

    pdf20 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 932 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 2: Primitive Data Types and OperationsIntroduction to Java Programming - Chapter 2: Primitive Data Types and Operations

    Naming Conventions, cont.  Class names: – Capitalize the first letter of each word in the name. For example, the class name ComputeArea.  Constants: – Capitalize all letters in constants, and use underscores to connect words. For example, the constant PI and MAX_VALUE

    pdf55 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 918 | Lượt tải: 0

  • Introduction to Java Programming - Chapter 1: Introduction to Computers, Programs, and JavaIntroduction to Java Programming - Chapter 1: Introduction to Computers, Programs, and Java

    Two Ways to Invoke the Method There are several ways to use the showMessageDialog method. For the time being, all you need to know are two ways to invoke it. One is to use a statement as shown in the example: JOptionPane.showMessageDialog(null, x, y, JOptionPane.INFORMATION_MESSAGE)); where x is a string for the text to be displayed, and y i...

    pdf39 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 962 | Lượt tải: 0

  • Lập trình Java - Chương 6: Lập trình JDBC (Java DataBase Connectivity) - Đại học công nghệ thông tinLập trình Java - Chương 6: Lập trình JDBC (Java DataBase Connectivity) - Đại học công nghệ thông tin

    Các loại JDBC Dirvers Drivers thuần java và hiện thực/dùng database protocol để giao tiếp trực tiếp với CSDL. Thường là những JDBC drivers nhanh nhất. Thường dùng socket kết nối trực tiếp với mỗi DBMS khác nhau Client -> JDBC Driver -> Native-protocol JDBC Driver -> database server.  Ưu điểm  Performance tốt nhất so với các kiểu khác  N...

    pdf30 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1033 | Lượt tải: 0

  • Lập trình Java - Chương 5: Kỹ thuật lập trình giao diện người dùng (GUI) trong Java - Đại học công nghệ thông tinLập trình Java - Chương 5: Kỹ thuật lập trình giao diện người dùng (GUI) trong Java - Đại học công nghệ thông tin

    Tạo một node trên cây làm root DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");  Tạo các node bên dưới DefaultMutableTreeNode category = null; DefaultMutableTreeNode book = null; category = new DefaultMutableTreeNode("Books for Java Programmers"); top.add(category); book = new DefaultMutableTreeNode( “Core Java”);...

    pdf56 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1015 | Lượt tải: 0

  • Lập trình Java - Chương 4: Lập trình đa luồng (MultiThread) trong Java - Đại học công nghệ thông tinLập trình Java - Chương 4: Lập trình đa luồng (MultiThread) trong Java - Đại học công nghệ thông tin

    Thread Scheduling  Ví dụ  Tạo lớp kế thừa Thread  Sử dụng phương thức sleep()  Công việc  Tạo 4 thread chạy song sọng, mỗi thread sẽ tạm ngưng thi hành một khoảng thời gian ngẫu nhiên.  Sau khi kết thúc sleeping sẽ in ra tên thread

    pdf43 trang | Chia sẻ: dntpro1256 | Ngày: 23/11/2020 | Lượt xem: 1118 | Lượt tải: 0