Write Function Receives String Array Array Objects Type String Find Total Number Charachte Q37075530

write a function that receives a String array (array of objectsof type String) and find the total number of charachters in allstrings //String [] StrArray = {“AAA”, “B”, “CC”, “DDDDDDD”};


Solution


//Main.javapublic class Main { public static int getTotalCount(String s[]){ int count = 0; for(int i = 0;i<s.length;i++){ count += s.length; } return count; } public static void main(String args[]){ String [] StrArray = {“AAA”, “B”, “CC”, “DDDDDDD”}; System.out.println(“Total number of characters in array:

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.