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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:49:48+00:00 2026-06-15T22:49:48+00:00

Hey the names in the program are in portuguese but I think its understandable,

  • 0

Hey the names in the program are in portuguese but I think its understandable, if you have any doubt just ask and i’ll translate.

So I’m getting a NullPointerException with these. The array Vector_Canais is initialized in the constructor:

public Box(int capacidade) {
        Time a = new Time();
        Vector_Canais = new Canal[DEFAULT_SIZE];
    }

public static void novoCanal() {
        Scanner in = new Scanner(System.in);

        Cnl = in.nextLine();
        Vector_Canais[i] = new Canal(Cnl);      
        i++;
    }

    public static String listaCanais(int i) {
        return (Vector_Canais[i].getCanal());
    }

public static void listaCanais() {
        for (int a = 0; a < 100; a++) {
            if (Box.listaCanais(a) != null) {
                System.out.println(Box.listaCanais(a));
            }
        }

i is initialized at 0.
Any ideas?

  • 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-15T22:49:49+00:00Added an answer on June 15, 2026 at 10:49 pm

    Most probably you haven’t initialized the array Vector_Canais or you haven’t initialized all of its members (for instance, novoCanal hasn’t been called 100 times before). Remember, making an array of size 100 (of a class) means making an array of 100 null slots, not 100 objects. Until you call a constructor for each of them, they may throw this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys i've just recently been getting a hang of sockets but ran into
hey guys having this really simple problem but cant seem to figure out have
Hey guys I'm making a chat program and I have a parent MessagePacket class
Hey all. I have written a program that sequentially scans certain parts of a
Hey all, got one mountain of a problem here. I have completed a program
Hey stupid question but I'm having a hard time connecting my java program to
Hey how do I in MFC get names of all folders? Any examples or
Hey, Lets say we have a query which generates list of city names as
Hey all, I'm writing a C program, and I want to have an array
Hey guys. I'm currently playing with YUV file. Do you have any suggestion on

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.