The amazing thing about Java

简介: The amazing thing about Java

正文


猜猜下面的代码能否输出?


/**
 * @author breakpoint/赵先生 <zlgtop@163.com>
 * create on 2022/05/28
 */
public class Mytest001 {
    public static void main(String[] args) {
        // \u000d System.out.println("hello word");
    }
}


答案当然是肯定的!!!!!!


下面说一说是为啥?


实际上,在我们的代码中,有一个特殊的字符`\u000d`


这个是一个特殊的Unicode码. 在java中表示换行的意思.所以,我们定义的那一行注释并没有真正的注释!!!!

Java的编译器不仅仅会编译代码,而且也会解析Unicode代码!!!

相关文章
java.lang.Error: Unresolved compilation problem: The type List is not generic; it cannot be parame
java.lang.Error: Unresolved compilation problem: The type List is not generic; it cannot be parame
|
3月前
|
设计模式 Java API
【Java】Best coding practices every java developer should
【Java】Best coding practices every java developer should
55 0
|
5月前
|
IDE Java 程序员
【Java】Best coding practices every java developer should(二)
【Java】Best coding practices every java developer should
34 0
|
5月前
|
设计模式 Java Unix
【Java】Best coding practices every java developer should(一)
【Java】Best coding practices every java developer should
41 0
|
Android开发 Kotlin
kotlin协程库报错“Program type already present”解决
最近在学习kotlin,学习到协程库这一块了,针对Android的话就是coroutines-android库。本来学习就不容易了,再加上kotlin现在还处于快速变化期,那个酸爽简直了,废话不多说,进入正题。
|
分布式计算 安全 Java
JDK15 is coming,Do you konw the new features of java8?(下)
JDK15 is coming,Do you konw the new features of java8?(下)
59 0
|
JavaScript Java 容器
JDK15 is coming,Do you konw the new features of java8?(上)
JDK15 is coming,Do you konw the new features of java8?(上)
66 0
|
Java
解决bug:项目配置java8时出现Error:Jack is required to support java 8 language features...
解决bug:项目配置java8时出现Error:Jack is required to support java 8 language features...
252 0
解决bug:项目配置java8时出现Error:Jack is required to support java 8 language features...
|
Java Scala
function implemented in Scala - compiled java code - some closure example
function implemented in Scala - compiled java code - some closure example
92 0
function implemented in Scala - compiled java code - some closure example
simple rxjava code programming style
simple rxjava code programming style package zhangphil.rx; import android.
883 0