Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created March 12, 2021 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuwei-k/8c8baf19f4067ca465023c44254b6973 to your computer and use it in GitHub Desktop.
Save xuwei-k/8c8baf19f4067ca465023c44254b6973 to your computer and use it in GitHub Desktop.
class A {
println("scala 1 " + s)
val s = "hello"
println("scala 2 " + s)
}
public class B {
{
System.out.println("java 1 " + s());
}
private String s0 = "hello";
public String s() {
return s0;
}
{
System.out.println("java 2 " + s());
}
}
[info] running Main
scala 1 null
scala 2 hello
java 1 null
java 2 hello
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