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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:25:21+00:00 2026-05-23T02:25:21+00:00

In Main: Equipe Eq1 = new Equipe(J,E); Equipe Eq2 = new Equipe(J,E); while(Eq1.equals(Eq2)) Eq2

  • 0

In Main:

Equipe Eq1 = new Equipe(J,E);
Equipe Eq2 = new Equipe(J,E);
while(Eq1.equals(Eq2))
Eq2 = new Equipe(J,E);

Match m = new Match(Eq1,Eq2);
String ChercherJoueur = m.QuelEquipe(m.hasBall());

In Class Equipe:

public Vector<Joueur> VJ;
public Equipe(Vector<Joueur> E, Vector<Entraineur> Ent) {
   VJ = new Vector<Joueur>();
   //rest of the logic
}
public Equipe() {
}

In Class Match:

Equipe Eq1 = new Equipe();
Equipe Eq2 = new Equipe();
public Match(Equipe Eq1, Equipe Eq2) {
Eq1 = this.Eq1;
Eq2 = this.Eq2;
}

public String QuelEquipe(Joueur J)
{
    boolean found = Eq1.ChercherJoueur(J);
    if(found == true)
        return "EQ1";
    else
        return "EQ2";
}

public Joueur hasBall()
{
    Joueur J = null;
    int i = 0;
    boolean found = false;

NullPointerException------->  System.out.println(Eq1.VJ.get(i).isBall());

System.out.println(Eq2.VJ.get(i).isBall());
    while(!found)
    {

        if((Eq1.VJ.get(i).isBall())==true)
        {
            found = true;
            J= Eq1.VJ.get(i);
        }

        else if((Eq2.VJ.get(i).isBall())==true)
        {
            found = true;
            J= Eq2.VJ.get(i);
        }
        i++;
    }
return J;
}
}

I think is all I need to include here to inform u about the situation.. I get a NullPointerException when I do “m.QuelEquipe(m.hasBall());” that can be traced back to where I pointed in The Class Match.. I know exactly what the exception means, and I’m changing their references with “Eq1 = this.Eq1;Eq2 = this.Eq2;” anyway.. sooo where is flow to get the code to work??

  • 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-05-23T02:25:22+00:00Added an answer on May 23, 2026 at 2:25 am

    Your constructor using two args does initialize the vector but the parameterless constructor doesn’t

    public Equipe(Vector<Joueur> E, Vector<Entraineur> Ent) {
        VJ = new Vector<Joueur>(); //<-- OK
        //rest of the logic
    }
    public Equipe() {
            //<-- errrk
    }
    

    Then when you invoke:

    System.out.println(Eq2.VJ.get(i).isBall());
    

    You’re using really invoking:

    Eq2.null.get  <-- NullPointerException 
    

    But the real problem though is in the Match constructor:

    public Match(Equipe Eq1, Equipe Eq2) {
        Eq1 = this.Eq1;
        Eq2 = this.Eq2;
    }
    

    Here you’re assigning to the local variable Eq1 the value of the instance variable Eq1 you really want it the other way around:

    public Match(Equipe Eq1, Equipe Eq2) {
        this.Eq1 = Eq1;
        this.Eq2 = Eq2;
    }
    

    BTW, this is not C# and in Java as a coding conventions both, methods and attributes start with lowecase and opening brace goes in the same line ( although this last part is not as relevant as the naming convention )

    I hope this helps.

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

Sidebar

Related Questions

class Main { public static void main(String[] args) { new Cloned().clone(); } } class
MAIN ACTIVITY public class MyActivity() extends Activity { onCreate() { MyClass myobj=new MyClass(); }
Main model classes are as follows : public class UserAddressesForm { @NotEmpty private String
main method: public static void main(String[] args) throws Exception { if (args.length != EXPECTED_NUMBER_OF_ARGUMENTS)
Main.java import java.io.IOException; public class Main { private final CompressedOutputStream m_cos; public static void
// main.cpp class Cat() { public: Cat() { a = 0; (*b) = 0;
Main class has two variables that want to access another class: public class MyClassA
Main Class: public class Blackjack { static Deck D; static Hand P; public static
Main Activity: private Button btnSubmit; private DataSource mDataSource; private Context mContext; @Override public void
main proc finit .while ang < 91 invoke func, ang fstp res print real8$(ang),

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.