i dont know what im doing wrong but the compiler keeps saying:
StringLength.java:3: error: class problem is public, should be declared in a file named problem.java public class problem
here is the code:
import java.util.Scanner;
public class problem {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a string");
String s = input.nextLine();
String lower = "";
String total = "";
for (int i = 0; i < s.length(); i++) {
char thisChar = s.charAt(i);
if (thisChar >= 97 && thisChar <= 122) {
lower += thisChar;
}
}
System.out.println("Total amount of characters: " + s.length() + " - " + s);
System.out.println("Lower case letters: " + lower.length() + " - " + lower);
}
}
can someone help me please?