Danh mục

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    
Hoai.2512

Phí tải xuống: 20,000 VND Tải xuống file đầy đủ (20 trang) 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- ...

Tài liệu được xem nhiều: