Java Programming for absolute beginner- P3
Số trang: 20
Loại file: pdf
Dung lượng: 458.70 KB
Lượt xem: 13
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:
Java Programming for absolute beginner- P3:Hello and welcome to Java Programming for the Absolute Beginner. You probablyalready have a good understanding of how to use your computer.These days it’s hard to find someone who doesn’t, given the importanceof computers in today’s world. Learning to control your computer intimatelyis what will separate you from the pack! By reading this book, you learnhow to accomplish just that through the magic of programming.
Nội dung trích xuất từ tài liệu:
Java Programming for absolute beginner- P3 JavaProgAbsBeg-01.qxd 2/25/03 8:12 AM Page 18 18 your procedure are. Comments also help when you go back and add new func- tionality to your code because you will be less likely to be confused by what you Java Programming for the Absolute Beginner had previously done. There are two basic types of comments in Java—single-line comments and multi-line comments. If you just want to make a note about a par- ticular line of code, you usually precede that line of code with a single-line com- ment as shown here: //The following line of code prints a message using standard output System.out.println(Hello, World!); Single-line comments start with double slashes //. This tells the compiler to dis- regard the following line of code. After the double slashes, you can type anything you want to on that single line and the compiler will ignore it. CK Single line comments are also commonly used to temporarily disable a line of TRI code during the debugging process. Simply add the double slashes at the begin- ning of the line of code to make the compiler skip the line. You typically do this if you want to test a modified version of the commented line or if you need to see how the program runs without executing that particular statement. This way, you don’t have to delete it and you can replace the statement simply by removing the double slashes. Sometimes you might want to write a comment that spans more than one line of code. You can precede each line with double slashes if you choose to, but Java allows you to accomplish this more easily. Simply start your comment with a slash followed by an asterisk: /*. You can type anything you want to after this, including carriage returns. To end this comment, all you need to do is type */. /* I just started a comment I can type whatever I want to now and the compiler will ignore it. So let It be written So let It be done Im sent here by the chosen one so let It be written so let It be done to kill the first born pharaoh son Im creeping death from Metallicas song, Creeping Death I guess Ill end this comment now */ Everything in between the start and end of this comment is considered free text. This means you can type anything you want to within them. If you take another look at the HelloWorld source code, you will notice that I used a multi-line com- ...
Nội dung trích xuất từ tài liệu:
Java Programming for absolute beginner- P3 JavaProgAbsBeg-01.qxd 2/25/03 8:12 AM Page 18 18 your procedure are. Comments also help when you go back and add new func- tionality to your code because you will be less likely to be confused by what you Java Programming for the Absolute Beginner had previously done. There are two basic types of comments in Java—single-line comments and multi-line comments. If you just want to make a note about a par- ticular line of code, you usually precede that line of code with a single-line com- ment as shown here: //The following line of code prints a message using standard output System.out.println(Hello, World!); Single-line comments start with double slashes //. This tells the compiler to dis- regard the following line of code. After the double slashes, you can type anything you want to on that single line and the compiler will ignore it. CK Single line comments are also commonly used to temporarily disable a line of TRI code during the debugging process. Simply add the double slashes at the begin- ning of the line of code to make the compiler skip the line. You typically do this if you want to test a modified version of the commented line or if you need to see how the program runs without executing that particular statement. This way, you don’t have to delete it and you can replace the statement simply by removing the double slashes. Sometimes you might want to write a comment that spans more than one line of code. You can precede each line with double slashes if you choose to, but Java allows you to accomplish this more easily. Simply start your comment with a slash followed by an asterisk: /*. You can type anything you want to after this, including carriage returns. To end this comment, all you need to do is type */. /* I just started a comment I can type whatever I want to now and the compiler will ignore it. So let It be written So let It be done Im sent here by the chosen one so let It be written so let It be done to kill the first born pharaoh son Im creeping death from Metallicas song, Creeping Death I guess Ill end this comment now */ Everything in between the start and end of this comment is considered free text. This means you can type anything you want to within them. If you take another look at the HelloWorld source code, you will notice that I used a multi-line com- ...
Tìm kiếm theo từ khóa liên quan:
Nhập môn lập trình lập trình website lập trình ngôn ngữ html giáo trình php lập trình C++Gợi ý tài liệu liên quan:
-
Đề cương chi tiết học phần Cấu trúc dữ liệu và giải thuật (Data structures and algorithms)
10 trang 317 0 0 -
Bài tập lập trình Windows dùng C# - Bài thực hành
13 trang 184 0 0 -
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 166 0 0 -
Giáo trình nhập môn lập trình - Phần 22
48 trang 138 0 0 -
[Thảo luận] Học PHP như thế nào khi bạn chưa biết gì về lập trình?
5 trang 131 0 0 -
8 trang 76 0 0
-
Bài giảng Nhập môn lập trình - Chương 12: Quản lý bộ nhớ
23 trang 63 0 0 -
Giáo trình Lập trình Website (Nghề Tin học ứng dụng - Trình độ Cao đẳng) - CĐ GTVT Trung ương I
156 trang 56 2 0 -
42 trang 48 0 0
-
Báo cáo đồ án môn học II: Thiết kế website bán đồng hồ
25 trang 47 0 0