Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:22:02+00:00 2026-06-14T20:22:02+00:00

I have an assignment to design a simple spam filter using a hash table

  • 0

I have an assignment to design a simple spam filter using a hash table to store a set of “bad words.” We discussed in class what a hash table is and how it’s used (ie. how elements are inserted, linear probing, quadratic probing, chained probing, etc.), but we never really discussed how to use the Java API Hashtable, which is required for this assignment. anyway, I’ve tried my best to implement it, however, I’m getting an exception that I cannot seem to trace with my debugger.

I’ve given up with inserting code here, I always have to spend time formatting it properly and it still doesn’t look good. So I’m putting it on Pastebin instead. It should make your lives easier too since it does syntax highlighting and line counting as well.

SpamFilter class
SpamFilterDriver class

I get NullPointerExceptions at the following lines in the SpamFilterDriver class:
line 78
line 96
line 115

Any help would be appreciated. I’m sure it’s probably something silly, but I’m just not seeing it at the moment.

Also, please note that the code is not finished yet in the least. The fact that the SpamFilter implements Serializeable will be used later on. Also, there are some empty methods, again, they will be implemented later, I just need to solve this problem first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:22:03+00:00Added an answer on June 14, 2026 at 8:22 pm

    you have to initialize your SpamFilter filter; in your SpamFilter Class. before calling any of its methods.

    on line 78, you are calling a method isBadWord().

    try initializing filter like below before calling any of its method. if you dont initialize your filter the default value is null and boom when you call a method with null BOOM BOOM NPE is thrown

        private static SpamFilter filter = new SpamFilter();// 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following assignment for homework. Requirements Design a class called TokenGiver with
I have an assignment to create a GUI using MATLAB GUIDE and am having
For my university assignment I have to design some basic managment system for sicknesses
why if we have pure virtual assignment operator in a base class, then we
I am working on a short java assignment that I have been set. The
I have a Assignment question about Java Generics. The given class is Product.java. It
As a homework assignment for my introductory programming course I have to design and
I have a generic Class I'm using to hold information loaded from a database.
I have the following database design: Employee Table: Username, Name, JobTitle, BadgeNo, IsActive, DivisionCode
Hi I have an assignment to teach a team the subject of design principle.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.