Array:
1.int array
class Main{
/*Every application in Java must contain the main method. The Java compiler starts executing the code from the main method*/
public static void main(String anyVar[]){
int [] array={1,2,3};
System.out.println("default values of int array:"+array);
System.out.println("values for int array\nint array[0]:"+array[0]+"\nint array[1]:"+array[1]+"\nint array[2]:"+array[2]);
}
Output:
default values of int array:[I@2a139a55
values for int array
int array[0]:1
int array[1]:2
int array[2]:3
Screenshot:
#happyCoding :)
Comments
Post a Comment