Skip to main content

Posts

Arrays Declaration Construction initialization

Arrays Declaration Construction initialization An array is a data structure that defines an indexed collection of fixed number of homogeneous data elements. Once the size of array is fixed there is no chance of increasing or decreasing its size. Array show wonderful performance when compared with the collections. Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8. Declaration of array: (Declaring a Variable to Refer to an Array) // declares an array of integers int[] anArray; An array declaration has two components: the array's type and the array's name An array's type is written as type [] , where   type   is the data type of the contained elements;   the brackets are special symbols indicating that this variable holds an array.The size of the array is...

Coding Standards

  Coding Standards Java coding standards: Sun recommended the following for the naming conventions. 1.In case of classes: The first letter should be capitalized and if the several words are linked together to form the name ,the first letter of the inner words should be upper case. For the classes the names should be nouns. Ex: Student, Customer ,Employee etc. 2.In case of Interfaces: For the interfaces the names should be adjective and follows camel case. Ex: Runnable .Serializable, cloneable, Comparable, Movable etc 3.In case of Methods: The first letter should be lower case and then normal camel case rules should be used. The names should be verb –noun pairs Ex:   getBalance(); doCalculation(0; setCustomerName(); 4.In case of variables: Like methods the camel case format should be used stating with a lower case letter. Ex:   buttonwidth; accountBalance mystring 5.Constants: java constants are created by marking variables as and final....