https://curelemonade2.hatenablog.com/entry/2021/03/12/180354
Created
March 12, 2021 10:14
-
-
Save xuwei-k/8c8baf19f4067ca465023c44254b6973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
println("scala 1 " + s) | |
val s = "hello" | |
println("scala 2 " + s) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class B { | |
{ | |
System.out.println("java 1 " + s()); | |
} | |
private String s0 = "hello"; | |
public String s() { | |
return s0; | |
} | |
{ | |
System.out.println("java 2 " + s()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] running Main | |
scala 1 null | |
scala 2 hello | |
java 1 null | |
java 2 hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]): Unit = { | |
new A | |
new B | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment