Created
September 19, 2024 23:20
-
-
Save vdeemann/88623029aa37ccc4f28f457143109179 to your computer and use it in GitHub Desktop.
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 characters
public class EchoTestDrive { | |
public static void main(String[] args) { | |
Echo e1 = new Echo(); | |
Echo e2 = new Echo(); | |
int x = 0; | |
while (x<4) { | |
e1.hello(); | |
// 0-1 1-2 2-3 3-4 | |
e1.count = e1.count + 1; | |
if (x>0) { | |
// 0-0 1-1 2-2 3-6 | |
e2.count = e2.count + 1; | |
} | |
if (x>1) { | |
// 0-0 1-0 2-5 3-10 | |
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... "); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment