Monday, June 25, 2018

How do you declare, instantiate, initialize and traverse an array?

Problem statement: How will you declare, initialize & traverse an array?
  1. class TestArray {
  2. public static void main(String args[]) {
  3. int a[] = new int[5];// declaration and instantiation.
  4. a[0] = 10;// initialization.
  5. a[1] = 20;
  6. a[2] = 70;
  7. a[3] = 40;
  8. a[4] = 50;
  9. }
  10. }

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...