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 7789269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:14:51+00:00 2026-06-01T21:14:51+00:00

Okay, so new Zombie variable created. private Zombie zombieA; zombie variable initialized zombieA =

  • 0

Okay, so

  • new Zombie variable created.
    private Zombie zombieA;
  • zombie variable initialized

    zombieA = new Zombie(1);
  • calls constructor in Zombie class:

    public Zombie(int type) {
    this.type = type;
    x=200;
    y=100;
    dx=1;
    paintA.setColor(Color.RED);}
    

Basically, I want the game class to create a new Zombie, with the type as 1 which will go through a switch and case to determine which type of zombie to create (level 1=10). The problem is when I run it my application force closes and i get the an error on:

zombieA = new Zombie(1);

from the initial class and an error on:

public Zombie(int type) {

from the Zombie class. I’ve been going over it again and again and i just can’t see the problem, anyone notice anything wrong?

  • 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-01T21:14:52+00:00Added an answer on June 1, 2026 at 9:14 pm

    It’s hard to tell without the stack trace, but I suspect that the problem is in this line:

    paintA.setColor(Color.RED);
    

    Are you sure that paintA has been properly initialized? it seems to me that it’s null and causing a NullPointerException in your constructor. If that’s the case, be sure to instantiate it first, something like this:

    paintA = new ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so say I have a class that looks like this : public class
Okay, I'm completely new to this. I created a python script that imports tkinter
Okay so I have started a new language in class. We are learning Scheme
Okay, so i have created a new support ticket system, but in my ticket
Or is it okay to do something like this: new Thread( new ThreadStart( delegate
Okay this is my 4th question today on Scheme, still pretty new to Scheme,
Okay, i am new for android developping, or any developping and getting this error.
Okay, so I'm fairly new to CakePHP. This is the setup: I've got a
Hey, I'm new to this site. I think it is great! Okay, here's the
Okay, as usual, I'm brand new to this... been researching and trial/erroring (yes that's

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.