Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Echo2 {
- int count = 0;
- void hello(){
- System.out.println("helloooo...");
- }
- }
- public class Echo1 {
- public static void main (String[] args) {
- Echo2 e1 = new Echo2();
- Echo2 e2 = new Echo2();
- int x = 0;
- while (x<4) {
- e1.hello();
- if (x>0) {
- e2.count=e2.count+e1.count;
- }
- e1.count = e1.count + 1;
- if (x == 3) {
- e2.count = e2.count + 1;
- }
- x=x+1;
- }
- System.out.println(e2.count);
- }
- }
Add Comment
Please, Sign In to add comment