Friday 21 October 2016

Why should we learn

11.2 Why should we learn Array

Why should we learn Array concept?
  • I hope by this time you may good in creating, declaring, and initializing the variables.
  • Suppose, if we want to declare same type of 10 variables, it might take a bit of time to declare one after one variable up-to 10.
  • It consumes time and leads code will be more larger.
  • To overcome this problem we need to learn array concept.
Requirement 1 : Create one int variable and assign with 10
Solution             int a = 10;
Requirement 2 : Create two int variables and assign with 20,30
Solution            int b = 20;
                        int c = 30;
Requirement 2 : Create three int variables and assign with 40,50,60
Solution            int d = 40;
                        int e = 50;
                        int f = 60;
  • So, I’m 100% sure the above solutions are valid, even James Gosling also will approve.   
  • Imagine that James Gosling might be reviewing the piece of code, while reviewing he may call over phone and suggest as Nireekshan can you please upgrade your skill set by array concept to improve above code.
Thanks for your time,
Nireekshan