Lecture An introduction to Object-Oriented Programming with Java - Chapter 2: Getting started with Java

We will describe the basic structure of simple Java programs in this chapter. We will also describe the steps you follow to run Java programs. We expect you to actually run these sample programs to verify that your computer (either your own or the one at the school’s computer center) is set up properly to run the sample programs presented in the book. It is important to verify this now. | Chapter 2 Getting Started with Java Chapter 2 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 object creation. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Objectives, cont. After you have read and studied this chapter, you should be able to Describe the process of creating and running Java programs. Use the Date, SimpleDateFormat, String, and JOptionPane classes from the standard Java packages. Develop Java programs using the incremental development approach. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program This first program displays a window on the screen. The size of the window is 300 x 200 pixels, and the default title is My First Java Program. The fundamental OOP concept illustrated by the program: An object-oriented program uses objects. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program /* Chapter 2 Sample Program: Displaying a Window File: */ import .*; class Ch2Sample1 { public static void main(String[ ] args){ JFrame myWindow; myWindow = new JFrame(); (300, 200); (“My First Java Program”); (true); } } ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Fig. Result of running the Ch2Sample1 program. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Fig. The program diagram for the Ch2Sample1 program. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Fig. The program diagram for the Ch2Sample1 program that shows the dependency relationship. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program To use an . | Chapter 2 Getting Started with Java Chapter 2 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 object creation. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Objectives, cont. After you have read and studied this chapter, you should be able to Describe the process of creating and running Java programs. Use the Date, SimpleDateFormat, String, and JOptionPane classes from the standard Java packages. Develop Java programs using the incremental development approach. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. The First Java Program This first program displays a window on the screen. The size of the window is 300 x 200 pixels, and the default title is My First Java Program. The fundamental OOP concept illustrated by the program: An .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.