{"id":656,"date":"2012-10-08T23:22:51","date_gmt":"2012-10-08T23:22:51","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=344"},"modified":"2012-10-08T23:22:51","modified_gmt":"2012-10-08T23:22:51","slug":"counting-array-arguments","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/counting-array-arguments\/","title":{"rendered":"Counting Array Arguments"},"content":{"rendered":"<pre>\npackage com.apryll.package2;\n\npublic class sample2 \n{\n  public static void main(String args[])  \n  {\n    sample2 objsample2 = new sample2();\n    objsample2.argCount(1, 2, 3, 4);\n  }\n\t\n  public void argCount(int num1, int num2, int... args)\n  {\n    System.out.println(num1);\n    System.out.println(num2);\n    System.out.println(args.length);\n  }\n}\n<\/pre>\n<p><strong>OP<\/strong><br \/>\n1<br \/>\n2<br \/>\n2<\/p>\n<p>Please Note the Last 2 which accounts for the array argument args as num1 and num2 does not account for array arguments<\/p>\n<p>If the Code is like below then it would have been a  error<\/p>\n<pre>\n  public void argCount(int num1, int num2, int... args)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>package com.apryll.package2; public class sample2 { public static void main(String args[]) { sample2 objsample2 = new sample2(); objsample2.argCount(1, 2, 3, 4); } public void argCount(int num1, int num2, int&#8230; args) { System.out.println(num1); System.out.println(num2); System.out.println(args.length); } } OP 1 2 2 Please Note the Last 2 which accounts for the array argument args as num1 and&hellip; <a href=\"https:\/\/codethataint.com\/blog\/counting-array-arguments\/\">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-656","post","type-post","status-publish","format-standard","hentry","category-arrays"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/656","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=656"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/656\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}