private static void stringFunction(String ourString)
I'm not sure what I need to do I am a first semester java programmer so any help will be appreciated.
Thank You...
Here is my code:
public class StringWalker
{
public static void main(String[] args)
{
String stringy = new String();
stringy =javax.swing.JOptionPane.showInputDialog(null);
System.out.println(" [" +stringy +"]");
int length = stringy.length();
System.out.println("Total Characters=" +length);
char c;
int digits = 0;
int lower = 0;
int upper = 0;
int special = 0;
for (int i = 0; i < length; i++)
{
c = stringy.charAt(i);
if (c >= '0' && c<='9')
{
digits ++;
}
if( Character.isLowerCase(c))
{
lower ++;
}
if( Character.isUpperCase(c))
{
upper ++;
}
else
{
special = length - digits - lower - upper;
}
}
System.out.println("Digits=" +digits);
System.out.println("Lower-case Letters=" +lower);
System.out.println("Upper-case Letters=" +upper);
System.out.println("Special Characters=" +special);
}
private static void stringFunction(String ourString)
{
System.out.println("now in the method");
System.out.println(ourString);
}
}

New Topic/Question
Reply




MultiQuote









|