OnJava8-Examples/references/PassReferences.java

18 lines
478 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: references/PassReferences.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-05-05 11:20:13 -07:00
// Passing references around.
public class PassReferences {
public static void f(PassReferences h) {
System.out.println("h inside f(): " + h);
}
public static void main(String[] args) {
PassReferences p = new PassReferences();
System.out.println("p inside main(): " + p);
f(p);
}
2015-05-18 23:05:20 -07:00
} /* Output:
p inside main(): PassReferences@19e0bfd
h inside f(): PassReferences@19e0bfd
*///:~