Java / Android Developer, Trainer, Writer, Speaker

Saturday, January 24, 2015

On 10:12 AM by Unknown in ,    18 comments

Like the article?

Array: An array is something more or less like a container of data. Array container contains same type of data.





Read More from Oracle >> Here!

Java Code for practicing:

import java.util.Arrays;
public class myarray {
public static  void main(String [] args) {

// declaring  an array in java
int[] javaArray = new int[10];

// array with values
String prof[] = {"lawyear", "engineer", "stupoid", "developer"};

// allowed but not preferred declaring java array
int buy[];
buy = new int[10];

// java array of numbers, integer
int javaNumberArray[] = {2,3,6,7,78,8};


int[] [] learn = { {1,2,3}, {4,5,6}, {7,8,9,81}, {10,11, 12} };
 

// how to print a java array length
System.out.println( " My Java Array leangth: "+ learn.length );

int s;
for( s=0; s < javaNumberArray.length; s++ ) {

System.out.println( "My Array output, according to index is: "+ javaNumberArray[s] );


}




// printing a 2d array in java
int p,q;
for( p=0; p < learn.length; p++ ) {
for(q=0; q< learn[p].length; q++ ) {

System.out.println(  learn[p][q] );


}

}


for(int n: javaNumberArray) {
   System.out.println("My Arrar Java Number is: "+ n);




int[] seo = {1,2,23,3,3,3,4,4,5,6,67,7,8,89,9,76,4,33,3,32 } ;

// print a java array in one line
System.out.println( "Size of SEO ArrAy is: "+ Arrays.toString(seo)) ;

// print a java 2d ( 2 dimentional ) array in one line
System.out.println( "Size of 2D Learn ArrAy is: "+ Arrays.deepToString(learn)) ;





}
}






Output:

 My Java Array length: 4
My Array output, according to index is: 2
My Array output, according to index is: 3
My Array output, according to index is: 6
My Array output, according to index is: 7
My Array output, according to index is: 78
My Array output, according to index is: 8
1
2
3
4
5
6
7
8
9
81
10
11
12
My Arrar Java Number is: 2
My Arrar Java Number is: 3
My Arrar Java Number is: 6
My Arrar Java Number is: 7
My Arrar Java Number is: 78
My Arrar Java Number is: 8
Size of SEO ArrAy is: [1, 2, 23, 3, 3, 3, 4, 4, 5, 6, 67, 7, 8, 89, 9, 76, 4, 33, 3, 32]
Size of 2D Learn ArrAy is: [[1, 2, 3], [4, 5, 6], [7, 8, 9, 81], [10, 11, 12]]

18 comments:

  1. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on update.
    Web Development Company in India

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.
    digital marketing training in annanagar

    ReplyDelete
  4. After reading your post I understood that last week was with full of surprises and happiness for you. Congratz! Even though the website is work related, you can update small events in your life and share your happiness with us too.
    AWS Training in chennai

    AWS Training in bangalore

    ReplyDelete
  5. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
    Blueprism online training

    Blue Prism Training in Pune

    Blueprism training in tambaram

    ReplyDelete
  6. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision. 

    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune

    ReplyDelete
  7. After reading your post I understood that last week was with full of surprises and happiness for you. Congratz! Even though the website is work related, you can update small events in your life and share your happiness with us too.
    java training in tambaram | java training in velachery

    java training in omr | oracle training in chennai

    ReplyDelete
  8. I likable the posts and offbeat format you've got here! I’d wish many thanks for sharing your expertise and also the time it took to post!!
    angularjs-Training in pune

    angularjs-Training in chennai

    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    ReplyDelete
  9. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
    python training in pune | python training institute in chennai | python training in Bangalore

    ReplyDelete
  10. Thanks For sharing a nice post about sap abap Training Course.It is very helpful and sap abap useful for us. oracle training in chennai

    ReplyDelete
  11. Chennai's best software training institute, Infycle Technologies, offers the best Hadoop training in Chennai for students and tech professionals along with other courses such as Python, Oracle, Selenium, Java, Data Science, Cyber Security, Hadoop, iOS, and Android development with 100% hands-on training. Once the completion of training, the students will be sent for placement interviews in the core MNC's. Call 7504633633 to get more info and a free demo. Best Hadoop Training in Chennai | Infycle Technologies

    ReplyDelete
  12. I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. data science training in kanpur

    ReplyDelete