Saturday, May 11, 2019

what will be the output of the following code?

Problem statement:
what will be the output of the following code?

  1. class ExecutionEight {
  2.     public int number = 0;
  3. }
  4. public class ExecutionSeven {
  5.     public void doIt(int i, ExecutionEight e) {
  6.         i = 5;
  7.         e.number = 8;
  8.     }
  9.     public static void main(String[] args) {
  10.         int x = 0;
  11.         ExecutionEight e = new ExecutionEight();
  12.         new ExecutionSeven().doIt(x, e);
  13.         System.out.println(x + " " + e.number);
  14.     }
  15. }
Output:
0 8

No comments:

Post a Comment

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...