{"id":626,"date":"2012-08-20T12:15:00","date_gmt":"2012-08-20T12:15:00","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=208"},"modified":"2012-08-20T12:15:00","modified_gmt":"2012-08-20T12:15:00","slug":"working-with-arrays-java","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/working-with-arrays-java\/","title":{"rendered":"Working With Arrays Java"},"content":{"rendered":"<p><strong>How to find Length of Array<\/strong><\/p>\n<pre>\npublic class Main \n{\n  public static void main(String args[])\n  {\n    int[] a = {1,2,3,4,5};\n    System.out.println(\"Length of array \" + a.length);\n  }\n}\n<\/pre>\n<p><strong>Two Dimensional Array &#8211; Java<\/strong><\/p>\n<pre>\n  class Main\n  {\n    public static void main(String args[])\n    {\n      int[][] a = {{1,2}, {3,4}};\n      System.out.println(\"Content of array \" + a[0][1]);     \n      System.out.println(\"Length of array \" + a[0].length);\n    }\n  }\n<\/pre>\n<p>OP: Content of array 2<br \/>\n    Length of array 2<\/p>\n<pre>\npublic class Main11\n{\npublic static void main(String args[])\n{\nString[] arrName = new String[5];\nint[] arrAge = {21, 25, 24, 26, 27};\nchar[] arrSection = {'A', 'B', 'C', 'D', 'E'};<\/code>\n\narrName[0] = \"Mugil\";\narrName[1] = \"Vinu\";\narrName[2] = \"Madhavan\";\narrName[3] = \"Adhavan\";\narrName[4] = \"Suryan\";\n\n\/\/Method 1\nfor(int i=0;i&lt;arrName.length;i++)\n{\nif(arrName[i] != null)\nSystem.out.println(arrName[i]);\n}\n\n\/\/Method 2\n\/\/For - Each Method\nfor(String item : arrName)\n{\nSystem.out.println(item);\n}\n\n\/\/Method 3\nint j =0;\nwhile(j&lt;arrAge.length)\n{\nSystem.out.println(arrAge[j]);\nj++;\n}\n\n\/\/Method 4\nint k=0;\ndo\n{\nSystem.out.println(arrSection[k]);\nk++;\n}while(k&lt;arrSection.length);\n}\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to find Length of Array public class Main { public static void main(String args[]) { int[] a = {1,2,3,4,5}; System.out.println(&#8220;Length of array &#8221; + a.length); } } Two Dimensional Array &#8211; Java class Main { public static void main(String args[]) { int[][] a = {{1,2}, {3,4}}; System.out.println(&#8220;Content of array &#8221; + a[0][1]); System.out.println(&#8220;Length of&hellip; <a href=\"https:\/\/codethataint.com\/blog\/working-with-arrays-java\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"class_list":["post-626","post","type-post","status-publish","format-standard","hentry","category-arrays"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=626"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/626\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}