yo, so im trying to make a program that can take string input from the user for instance: "ONCE UPON a time" and then report back how many upper and lowercase letters the string contains:
output example: the string has 8 uppercase letters
the string has 5 lowercase letters, and im supposed to use string class not arrays, any tips on how to get started on this one? thanks in advance, here is what I have done so far :D!
import java.util.Scanner;
public class q36{
public static void main(String args[]){
Scanner keyboard = new Scanner(System.in);
System.out.println("Give a string ");
String input=keyboard.nextLine();
int lengde = input.length();
System.out.println("String: " + input + " " + "lengde:"+ lengde);
for(int i=0; i<lengde;i++) {
if(Character.isUpperCase(CharAt(i))){
}
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…