Count the number of lines number of words and number of characters in a given paragraph - Java Quiz Question

Write a program to calculate the number of lines, words and characters in a given paragraph. Exclude the words 'a, an, the, is' and spaces while counting words and characters. Include special characters and full stop while counting the characters.

Input (String, For display purpose new line is shown as $) Output (String)
Programmers experienced with C and C++ can easily learn Java and rewrite the code.$Java and C/C++ will continue to coexist,$since Java solves certain problems and C/C++ solves certain other problems Lines = 3, Words = 31, Characters = 164
Hi, this is Merit Campus, I am not the king of java$I am also not the emperor of java, I don't like to rule over people, I like to win their love Lines = 2, Words = 30, Characters = 104
Sun rises in the east Lines = 1, Words = 4, Characters = 14

class CountNumberOfLinesWordsAndCharactersInAParagraph

{    public static void main(String s[])
        String paragraph = "Java's primary motivation was platform independence and not internet.\r\n Platform independence means the ability to write a program on one platform and run\r\n it on any other platform without worrying about the platform specific features. If it works on one platform,\r\n it should work on all other platforms.";
        System.out.println("The Paragraph details are : " + getParagraphDetails(paragraph));


public static ParagraphDetails getParagraphDetails(String paragraph) {
//Write a code here to get the number of lines, number of words and number characters and return them. Exclude the words 'a, an, the, is' and spaces while counting words and characters.
class ParagraphDetails {

int lines;
int words;
int characters;

public ParagraphDetails(int lines, int words, int characters) {
this.lines = lines;
this.words = words;
this.characters = characters;

public String toString() {
return "Lines = " + lines + ", " + "Words = " + words + ", " + "Characters = " + characters;