ObjPassvalue.java 328 B

12345678910111213141516
  1. package samples.technology.reference;
  2. class PassObj {
  3. String str = "init value";
  4. }
  5. public class ObjPassvalue {
  6. public static void main(String[] args) {
  7. PassObj objA = new PassObj();
  8. PassObj objB = objA;
  9. objA.str = "changed in objA";
  10. System.out.println("Print objB.str value: " + objB.str);
  11. }
  12. }