Pangram Program in Java

A string is known as pangram if it has all the alphabets from a to z at least once. A popular example of pangram sentence is “The quick brown fox jumps over the lazy dog”.

Here are some other examples of pangram sentences.

  • “How vexingly quick daft zebras jump”
  • “Bright vixens jump; dozy fowl quack”
  • “Quick zephyrs blow, vexing daft Jim”
  • “Sphinx of black quartz, judge my vow”
  • “Five quacking zephyrs jolt my wax bed”

Now let’s have a look at how to check if a string is pangram in java.


This is a pangram


  • First, we created a boolean array to store the occurrence of each letter. Initially, its value is false.
  • We converted the string to lowercase for uniformity.
  • Now we iterate through each character of the string and if it’s between a to z then we mark the corresponding index of the boolean array as true.
  • After that we check each element of the boolean array, if all the elements are true then the string is pangram otherwise not.

Leave a Comment

Your email address will not be published. Required fields are marked *