Lecture Java methods: Object-oriented programming and data structures (3rd AP edition): Chapter 3 - Maria Litvin, Gary Litvin

Chapter 3 - Objects and classes. This chapter gives an introduction to the main Java and OOP concepts but does not require their full understanding. In terms of grasping the big picture, each student proceeds at his or her own pace. The same concepts are covered later in more depth. Here students get a general idea of how things are put together, get a feel for OOP, and work on exercises that require rearranging small pieces of code. | Java Syntax and Style /** * Chapter 3 */ Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin 3rd AP edition 3- This is an important chapter because it explains and contrasts two related aspects of writing code in a high-level programming language: language syntax rules and good programming style. Objectives: Learn to distinguish the required Java syntax from the conventional style Learn when to use comments and how to mark them Review reserved words and standard names Learn the proper style for naming classes, methods, and variables Learn to space and indent blocks of code 3- An unstated objective is to give students some appreciation for what is involved in creating working code and the required level of attention to detail. Comments Comments are notes in plain English inserted in the source code. Comments are used to: document the program’s . | Java Syntax and Style /** * Chapter 3 */ Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin 3rd AP edition 3- This is an important chapter because it explains and contrasts two related aspects of writing code in a high-level programming language: language syntax rules and good programming style. Objectives: Learn to distinguish the required Java syntax from the conventional style Learn when to use comments and how to mark them Review reserved words and standard names Learn the proper style for naming classes, methods, and variables Learn to space and indent blocks of code 3- An unstated objective is to give students some appreciation for what is involved in creating working code and the required level of attention to detail. Comments Comments are notes in plain English inserted in the source code. Comments are used to: document the program’s purpose, author, revision history, copyright notices, etc. describe fields, constructors, and methods explain obscure or unusual places in the code temporarily “comment out” fragments of code 3- How detailed should comments be? In general, self-documenting, clear code is better than obscure, heavily commented code. Use comments to mark important sections and occasionally explain unexpected twists of logic or use, but do not comment every statement. Sometimes you need to comment out a fragment of code to try a variation or to test the remaining code separately. Formats for Comments A “block” comment is placed between /* and */ marks: A single-line comment goes from // to the end of the line: /* Exercise 3-2 for Java Methods Author: Miss Brace Date: 3/5/2020 Rev. */ weight *= ; // Convert to kilograms 3- Make sure you do not carry a // comment over to the next line. If you do, you need another // mark on that line. Placing // at the beginning of a line comments out that line.

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
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.