tailieunhanh - Java Programming for absolute beginner- P3
Java Programming for absolute beginner- P3:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | 2 25 03 8 12 AM Page 18 k 0 c c 0 2 V your procedure are. Comments also help when you go back and add new functionality to your code because you will be less likely to be confused by what you 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 particular line of code you usually precede that line of code with a single-line comment as shown here The following line of code prints a message using standard output Hello World Single-line comments start with double slashes . This tells the compiler to disregard 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. 0 a c E E s k a o k a s s Single line comments are also commonly used to temporarily disable a line of code during the debugging process. Simply add the double slashes at the beginning 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 I m sent here by the chosen one so let It be written so let It be done to kill the first born pharaoh son I m creeping death from Metallica s song Creeping Death I .
đang nạp các trang xem trước