Skip to content

Instantly share code, notes, and snippets.

@aniketmlk6
Last active July 2, 2021 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniketmlk6/86aa088b0d4b737260afc69dcc2c2e5c to your computer and use it in GitHub Desktop.
Save aniketmlk6/86aa088b0d4b737260afc69dcc2c2e5c to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
String input = "Java is awesome";
String inputWithoutSpaces = input.replace(" ","");
// System.out.println(inputWithoutSpaces); // String without spaces
int count = inputWithoutSpaces.length();
System.out.println("Total characters without spaces : " + count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment