The code would be as such..
Basically i am attempting to make use of values in argv, in string.import java.util.*; // Import for Scanner class public class test { public static void main(String[] args) { // TO DO code application logic here System.out.println("testing in progress::start"); if(args.length == 5) // to test number of inputs { System.out.println("correct number of inputs"); //testing for input success. if( args[0].equals("hey") && args[1].equals("-e") ) { System.out.println("testing in progress::current"); // Create Scanner object to take input from command prompt //Scanner s=new Scanner(System.in); // Take input argv3 == key String s = args[2]; // Initialize the variable count to 0 int count=0; // Convert String st to char array char[] c=s.toCharArray(); System.out.println(s); // Loop till end of string for(int i=0;i<s.length();i++) //If character at index 'i' is not a space, then increment count if(c[i]!=' ') count++; //Print no.of chars other than spaces (to check space is 10 or smaller. :: yet tested) System.out.println("No.of chars other than spaces are "+count); } else { System.out.println("testing :: error"); System.out.println(args[0]); } } else { System.out.println("testing in progress::end"); } } }
currently trying to read out one input to verify data.. to code for input verification. e.g argv0 to compare a particular string input e.g that args counter should be more then 0 but not more then 10