Thursday, 9 July 2015

Arrays

An array is a indexing form of data. A specific element in an array is accessed by its index. Arrays offer a convenient means of grouping related information.

An array is a group of like-typed variables that are referred to by a common name. Arrays of
any type can be created and may have one or more dimensions. A specific element in an array is accessed by its index. Arrays offer a convenient means of grouping related information.
ARRAY will be initialized as :

ar[5]={"name","class","roll_no","marks","regd_no"};

Another type of initialization of an array

int a[5];
in FOR LOOP we can access as

Scanner z=new Scanner (System.in);//Input at the run time from the user
for(int i=0;i<=5;i++){
a[i]=z.next();
system.out.println(a[i]);
}

Definition of the methods and keywords use in the Programm

public static void main(String [ ]args)

public means which can access from anywhere in the class

static means which can loaded as first in the class.

void all know about is it. Its is no return type.

main means they first find the main method of the class where is the main method of the                  class.
             main always in small alphabetic form because it is case sensitive and can not know              about MAIN.
String means they get the string form of the data as like "NAME".

args[ ] this is defined as because of storing and accessing the data of the array stored in the heap memory.

System.out.println("HELLO WORLD");

System is the class which is in-build in the jdk{(java development kit) which provide enviroment of the system} and "s" of the system is to be capital always.

out it is the object of the system class.

println is the method which is used to print the string on the console
             normal print is used to print string in a line whenever println is used to change the                  line in next line.


No comments:

Post a Comment