Results 1 to 2 of 2
Thread: Example Count From Array Snippet
- 05-18-2012, 03:12 AM #1
Member
- Join Date
- May 2012
- Location
- USA
- Posts
- 38
- Rep Power
- 0
Example Count From Array Snippet
Simple script I made to count everything in a array, and to display it with proper grammar. I gave decent commentary, should sum everything up.
Java Code:/** * */ /** * @author Vinx @ http://www.java-forums.org * */ public class Program { /** * @param args */ public static void main(String[] args) { String[] getShells = {"http://127.0.0.1/shell.php", "http://127.0.0.1/shell.php", "http://127.0.0.1/shell.php"}; // List of shells String shellWord = "shells"; // Define shellword string String areIs = "are"; // areIS, defined string to be changed for proper grammar in sentence. int shellCount = (int) getShells.length; // Get the number of shells as integer if (shellCount == 1) { // If shellCount is 1, then do the following measures: shellWord = "shell"; // Say shell instead of shells areIs = "is"; // Say is instead of are } System.out.println("There " + areIs + " " + shellCount + " " + shellWord); // Say the final sentence to console :D } }
- 05-18-2012, 05:22 AM #2
Similar Threads
-
Duplicate count in array
By louboulos in forum New To JavaReplies: 2Last Post: 05-10-2012, 05:37 PM -
How to count records WITHOUT an array?
By teekei in forum New To JavaReplies: 17Last Post: 07-25-2011, 12:42 PM -
How do I count empty spaces in a byte array?
By nessa203 in forum New To JavaReplies: 13Last Post: 01-11-2010, 05:46 PM -
i can do count, but having problem with array
By judy318 in forum New To JavaReplies: 4Last Post: 10-29-2009, 09:23 PM -
Array count number Occurances
By gwithey in forum New To JavaReplies: 2Last Post: 04-17-2009, 08:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks