Unit 3 Array in C# Introduction An array is a collection of variables of the same data type , stored in contiguous memory locations , and accessed using a common name and index . Each item in an array is called an element , and the index of arrays in C# starts from 0 . Key Points About Arrays in C#: 1. Elements are stored in contiguous memory locations. 2. Index starts from 0. So, for an array of size 5, valid indexes are 0 to 4. 3. Arrays are reference types and are allocated on the heap. 4. C# array is an object of base type System.Array . 5. Array elements can be of any type , including another array (array of arrays). 6. Jagged array (array of arrays) elements are reference type...
Features Of OOP Object Objects are the entities through which we perceive the world around us. We naturally see our environment as being composed of things which have recognizable identities and behavior. The entities are then represented as objects in the program. In OOP system, an object is the run time entity i.e. a region of storage with associated semantics. In OOP "Object" usually means an instance of a class. Example of Class and Object public class Main //Main is name of class { int num = 15; public static void main(String[] args) { Main myObj1 = new Main(); Main myObj2 = new Main(); // myObj1 and myObj2 are object of main class System.out.println(myObj1.num); System.out.println(myObj2.num); } } Abstraction Abstraction means showing only the essential details and hiding the unnecessary parts . It helps reduce co...