May*_*ari 0 java compiler-construction
我只是想知道java编程语言中多行注释中单个的区别.
多行评论
/*
* This is line 1
* This is line 2
/*
Run Code Online (Sandbox Code Playgroud)
单行评论
// This is line 1
// This is line 2
Run Code Online (Sandbox Code Playgroud)
那么在从.java到.class的程序转换方面,这两条评论会有什么不同(换句话说,为什么我们需要单行注释,当我们已经有多行注释时).我已经知道Lexical Analyzer阶段的编译器会删除注释.
这对程序员来说只是一种便利.例如,我不想在每一行//写一段评论时为每一行添加前缀.此外,/* */允许您将评论'内联',
System.out.println(2 + /* inline comment */ 2);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4433 次 |
| 最近记录: |