![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
Lecture Java programming language: Methods - Ho Dac Hung
Số trang: 10
Loại file: pdf
Dung lượng: 137.30 KB
Lượt xem: 9
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Methods has main content such as program development using methods, program development using methods, writing methods, method parameters, method overloading, the return statement, documenting methods.
Nội dung trích xuất từ tài liệu:
Lecture Java programming language: Methods - Ho Dac Hung Methods Ho Dac Hung1 Program Development Using Methods The solution to a task can be developed by breaking the task down into smaller subtasks. These subtasks can then be reduced to yet simpler task. This problem-solving approach described a software development process called top-doen development.2 Program Development Using Methods In top-down development, the first level of subtasks translate into the main() method. Levels of tasks below main() are developed into a series of additional methods.3 Writing Methods A method consists of a declaration and a body. The method declaration includes access level, return type, name, and parameters, if any. The method body contains the statements that implement the method. A method takes the form: (){ }4 Method Parameters A method declaration can include method parameters, which accept values from the method call. The data passed to the method can then be used inside the method to perform its task.5 Method Parameters Data is given, or passed to a method by enclosing the data in parentheses in the method call. The value or variable passed to a method is called the argument.6 Method Parameters In Java, arguments are passed by value, which means that the data stored in an argument is pass. An argument that is a primitive data type gives the method a copy of its value. An argument that is an object gives the method a copy of its reference. When a method declaration includes more than one parameterm the parameters are seperated by commas.7 Method Overloading The method declaration is used by the compiler to determine which method is execute. Therefore, methods name do not have to be unique as long as the parameters are different foe methods with the same name. Method overloading is when more than one method of the same name is included in a class.8 The return Statement A method can return a value. The return statement is used to send a value back to the calling statement. A return statement can return only one “value”. A method that return a value must include the return type in the method declaration.9 Documenting Methods Methods should be carefully commented so that a reader of the program understands what task the method is performing and what data, if any, will be returned by the method. Method documentation is in the form of documentation comments.10
Nội dung trích xuất từ tài liệu:
Lecture Java programming language: Methods - Ho Dac Hung Methods Ho Dac Hung1 Program Development Using Methods The solution to a task can be developed by breaking the task down into smaller subtasks. These subtasks can then be reduced to yet simpler task. This problem-solving approach described a software development process called top-doen development.2 Program Development Using Methods In top-down development, the first level of subtasks translate into the main() method. Levels of tasks below main() are developed into a series of additional methods.3 Writing Methods A method consists of a declaration and a body. The method declaration includes access level, return type, name, and parameters, if any. The method body contains the statements that implement the method. A method takes the form: (){ }4 Method Parameters A method declaration can include method parameters, which accept values from the method call. The data passed to the method can then be used inside the method to perform its task.5 Method Parameters Data is given, or passed to a method by enclosing the data in parentheses in the method call. The value or variable passed to a method is called the argument.6 Method Parameters In Java, arguments are passed by value, which means that the data stored in an argument is pass. An argument that is a primitive data type gives the method a copy of its value. An argument that is an object gives the method a copy of its reference. When a method declaration includes more than one parameterm the parameters are seperated by commas.7 Method Overloading The method declaration is used by the compiler to determine which method is execute. Therefore, methods name do not have to be unique as long as the parameters are different foe methods with the same name. Method overloading is when more than one method of the same name is included in a class.8 The return Statement A method can return a value. The return statement is used to send a value back to the calling statement. A return statement can return only one “value”. A method that return a value must include the return type in the method declaration.9 Documenting Methods Methods should be carefully commented so that a reader of the program understands what task the method is performing and what data, if any, will be returned by the method. Method documentation is in the form of documentation comments.10
Tìm kiếm theo từ khóa liên quan:
Java programming language Bài giảng ngôn ngữ lập trình Java Program development using methods Program development using methods The method parametersTài liệu liên quan:
-
Bài giảng Chương 1: Cơ bản về ngôn ngữ lập trình Java
19 trang 27 0 0 -
Bài giảng Ngôn ngữ lập trình Java: Chương 6.2 - TS. Phan Nguyên Hải
34 trang 26 0 0 -
Bài giảng Ngôn ngữ lập trình Java: Phần 2 - TS. Vũ Hữu Tiến
65 trang 24 0 0 -
Bài giảng Công nghệ Java: Chương 0 - Trần Quang Diệu
6 trang 23 0 0 -
Lecture Introduction to Java programming - Chapter 15: Graphics
32 trang 22 0 0 -
Bài giảng Ngôn ngữ lập trình Java căn bản
115 trang 21 0 0 -
Lecture Java programming language: Inheritance and Polymorphism - Ho Dac Hung
11 trang 21 0 0 -
Lecture Introduction to Java programming - Chapter 1: Introduction to computers, programs, and Java
63 trang 19 0 0 -
Bài giảng Ngôn ngữ lập trình Java: Chương 4 - TS. Phan Nguyên Hải
56 trang 19 0 0 -
Bài giảng Ngôn ngữ lập trình Java: Chương 6.1 - TS. Phan Nguyên Hải
74 trang 18 0 0