tailieunhanh - Lecture Java™ How to Program (8/e) - Chapter 3: Introduction to classes and objects

After studying this chapter you will be able to understand: What classes, objects, methods and instance variables are; how to declare a class and use it to create an object; how to declare methods in a class to implement the class's behaviors; how to declare instance variables in a class to implement the class's attributes; how to call an object's method to make that method perform its task;. | Java™ How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved. (C) 2010 Pearson Education, Inc. All rights reserved. (C) 2010 Pearson Education, Inc. All rights reserved. Covered in this chapter Classes Objects Methods Parameters double primitive type (C) 2010 Pearson Education, Inc. All rights reserved. Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down on its accelerator pedal. Before you can drive a car, someone has to design it. A car typically begins as engineering drawings, similar to the blueprints used to design a house. These include the design for an accelerator pedal to make the car go faster. (C) 2010 Pearson Education, Inc. All rights reserved. Analogy to help you understand classes and their contents. The pedal “hides” from the driver the complex mechanisms that actually make the car go faster, just as the brake pedal “hides” the mechanisms that slow the . | Java™ How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved. (C) 2010 Pearson Education, Inc. All rights reserved. (C) 2010 Pearson Education, Inc. All rights reserved. Covered in this chapter Classes Objects Methods Parameters double primitive type (C) 2010 Pearson Education, Inc. All rights reserved. Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down on its accelerator pedal. Before you can drive a car, someone has to design it. A car typically begins as engineering drawings, similar to the blueprints used to design a house. These include the design for an accelerator pedal to make the car go faster. (C) 2010 Pearson Education, Inc. All rights reserved. Analogy to help you understand classes and their contents. The pedal “hides” from the driver the complex mechanisms that actually make the car go faster, just as the brake pedal “hides” the mechanisms that slow the car and the steering wheel “hides” the mechanisms that turn the car. This enables people with little or no knowledge of how engines work to drive a car easily. Before you can drive a car, it must be built from the engineering drawings that describe it. A completed car has an actual accelerator pedal to make the car go faster, but even that’s not enough—the car won’t accelerate on its own, so the driver must press the accelerator pedal. (C) 2010 Pearson Education, Inc. All rights reserved. Performing a task in a program requires a method. The method describes the mechanisms that actually perform its tasks. Hides from its user the complex tasks that it performs, just as the accelerator pedal of a car hides from the driver the complex mechanisms of making the car go faster. In Java, a class houses a method, just as a car’s engineering drawings house the design of an accelerator pedal. In a class, you provide one or more methods that are designed to perform the class’s tasks. (C) 2010 .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.