Đang chuẩn bị liên kết để tải về tài liệu:
Lecture An Introduction to Object-Oriented Programming with Java (4/e): Chapter 2 - C. Thomas Wu

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Chapter 2 - Getting started with Java. After you have read and studied this chapter, you should be able to: Identify the basic components of Java programs; write simple Java programs; describe the difference between object declaration and creation; describe the process of creating and running Java programs; use the Date, SimpleDateFormat, String, and Scanner standard classes; develop Java programs, using the incremental development approach. | Chapter 2 Getting Started with Java 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Objectives After you have read and studied this chapter, you should be able to Identify the basic components of Java programs Write simple Java programs Describe the difference between object declaration and creation Describe the process of creating and running Java programs Use the Date, SimpleDateFormat, String, and JOptionPane standard classes Develop Java programs, using the incremental development approach 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program The fundamental OOP concept illustrated by the program: An object-oriented program uses objects. This program displays a window on the screen. The size of the window is set to 300 pixels wide and 200 pixels high. Its title is set to My First Java Program. 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. It’s kind of obvious, but the most fundamental important concept in OOP is the use of objects in a program. We will illustrate this key concept in the first sample program. The program, when executed, will display a window on the screen. The text displayed in the window’s title bar will be My First Java Program. The size of the window is set to 300 pixels wide and 200 pixels high. Program Ch2Sample1 import javax.swing.*; class Ch2Sample1 { public static void main(String[ ] args) { JFrame myWindow; myWindow = new JFrame( ); myWindow.setSize(300, 200); myWindow.setTitle(“My First Java Program”); myWindow.setVisible(true); } } Declare a name Create an object Use an object 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Based on what you learned about objects in the previous lessons and the description of the program in previous slide, can you make some sense from this program code? The . | Chapter 2 Getting Started with Java 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Objectives After you have read and studied this chapter, you should be able to Identify the basic components of Java programs Write simple Java programs Describe the difference between object declaration and creation Describe the process of creating and running Java programs Use the Date, SimpleDateFormat, String, and JOptionPane standard classes Develop Java programs, using the incremental development approach 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program The fundamental OOP concept illustrated by the program: An object-oriented program uses objects. This program displays a window on the screen. The size of the window is set to 300 pixels wide and 200 pixels high. Its title is set to My First Java Program. 4th Ed Chapter 2 - ©The McGraw-Hill Companies, Inc. .