SoftwareTestPilot
LearnCoding RoundsCommunityJobsQA Resources
All questions
BasicJava~5 min

Java: count vowels in a string

Java automation / SDET interview rounds

Points available

100/100

Your mission

  1. Read
  2. 2Run
  3. 3Submit
  4. 4Solve

Write static int countVowels(String s) returning how many vowels (a, e, i, o, u, any case) the string contains.

Examples

countVowels("Automation") → 6

Real Java 8 runs in your browser. Write your code in class Solution; java.util, java.util.stream and java.util.function are imported for you. The first run loads Java and can take 10–20 seconds.

Hints

Each hint costs 10 points on a full solve.

Interviewer follow-ups

  • What is the time and space complexity?
  • Which edge cases would you test?

Ctrl+Enter to run · add Shift to submit

1
2
3
4
5
6
7
8
9
10
Tab inserts two spaces. Press Escape, then Tab, to leave the editor.
Terminal

$ javac Main.java && java Main

Run executes the open file. Submit scores solution.java against hidden tests.

SoftwareTestPilot

Learn QA, prove your skills, connect with testers and grow your career.

Platform
  • Learn
  • Community
  • Jobs
Resources
  • QA Resources
  • Interview Questions
  • QA Tools
  • Articles
  • Products
Company
  • About
  • Contact
  • Authors & Reviewers
  • Editorial Policy
  • Sitemap
© 2026 SoftwareTestPilot. All rights reserved.
Operated by SoftwareTestPilot · Pune, Maharashtra, India · softwaretestingsapiens@gmail.com
PrivacyTermsCookiesDisclaimerRefundsAccessibility