Java Java Data Structures Organizing Data Splitting Strings

return mBody.toLowerCase().split("[\\s+]"); why i get expected 11 return 12 as error

why i get expected 11 return 12 as error

package com.example;

import java.util.Date;

public class BlogPost {
  private String mAuthor;
  private String mTitle;
  private String mBody;
  private String mCategory;
  private Date mCreationDate;

  public BlogPost(String author, String title, String body, String category, Date creationDate) {
    mAuthor = author;
    mTitle = title;
    mBody = body;
    mCategory = category;
    mCreationDate = creationDate;
public String[] getWords(){
return mBody.toLowerCase().split("[\\s+]");
  public String getAuthor() {
    return mAuthor;

  public String getTitle() {
    return mTitle;

  public String getBody() {
    return mBody;

  public String getCategory() {
    return mCategory;

  public Date getCreationDate() {
    return mCreationDate;

1 Answer

Craig Dennis
Craig Dennis
Treehouse Teacher

The plus goes on the outside of the character search, otherwise you are splitting on any space character and plus signs.

Hope that helps!