Created
September 20, 2024 10:56
-
-
Save vdeemann/1a8069928336216e2bd3e76d44b59373 to your computer and use it in GitHub Desktop.
Revisions
-
vdeemann created this gist
Sep 20, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ public class EchoTestDriveBonus { public static void main(String[] args) { Echo e1 = new Echo(); Echo e2 = e1; int x = 0; while (x<4) { e1.hello(); // 0-1 1-2 2-4 3-11 e1.count = e1.count + 1; if (x>0) { // 0- 1-3 2-5 3-12 e2.count = e2.count + 1; } if (x>1) { // 0- 1- 2-10 3-24 e2.count = e2.count + e1.count; } x = x + 1; } System.out.println(e2.count); } } class Echo { int count = 0; void hello() { System.out.println("helloooo... "); } }