Introduction: An array is an index collection of a fixed number of homogeneous data elements. The main advantage of the array is, we can represent a huge number of values using a single variable. So, the readability of the code will be improved. But the main disadvantage of an array is, fixed in size. i.e. Once we create an array there is no chance of increasing or decreasing the size based on our requirement. Hence, to use the array concept compulsory we should know the size in advance, which may not possible always. Array Declaration: There are three ways to declare the one-dimensional array. They are as follows int[] x; int []x; int x[]; All above are valid, but int[] x; is recommended, because variable name clearly separated from the type of array. At the time of declaration, we can't spec
Literals: Any constant value which can be assigned to the variable is called literal. 1 . Integer Literals: For integral data types ( byte, short, int, long ), we can specify a literal value in the following base... a) Decimal literal (base 10): Allowed digits are 0 to 9. e.g. int x = 10; b) Octal literal (base 8): Allowed digits are 0 to 7. Literal should be prefixed with '0' (Zero). e.g. int x = 010; c) Hexa decimal literal (base 16): Allowed digits are 0 to 9, a to f. For extra digits (a to f), we can use both lowercase and uppercase c