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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:30:10+00:00 2026-05-27T18:30:10+00:00

I am not finding any error in this class, but Netbeans continuously showing red

  • 0

I am not finding any error in this class, but Netbeans continuously showing red symbol on that class. Class is

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ea;

/**
 *
 * @author riyad
 */

import java.util.Random;
import java.util.BitSet;

public class Individual 
{
    BitSet variable;

    double x;
    double fitness;
    double sharedFitness;
    final int SIZE;


    Random generator = new Random();

    public Individual(int SIZE)
    {
        this.variable = new BitSet(SIZE);
        this.fitness = 0;
        this.sharedFitness = 0;
        this.SIZE = SIZE;


        for(int i=0; i<SIZE; i++)
        {
            if(generator.nextBoolean())
            {
                variable.set(i);
            }
            else
            {
                variable.clear(i);
            }
        }

        x = Double.parseDouble(variable.toString());
    }


    public Individual copy()
    {
        Individual ind = new Individual(SIZE);

        this.variable = (BitSet) ind.variable.clone();
        this.fitness = ind.fitness;
        this.sharedFitness = ind.sharedFitness;
        this.x = ind.x;

        return ind;
    }

    public void evaluate()
    {
        fitness = x * Math.sin(Math.sqrt(x));
    }

    public boolean getBit(int i)
    {
        return variable.get(i);
    }

    public BitSet getBitSet()
    {
        return variable;
    }

    public void setBit(int i)
    {
        variable.set(i);
    }

    public void clearBit(int i)
    {
        variable.clear(i);
    }

    public double getFitness()
    {
        return fitness;
    }

    public double sharedFitness()
    {
        return sharedFitness;
    }

    public void setSharedFitness(double fitness)
    {
        this.sharedFitness = fitness;
    }

    public void setFitness(double fitness)
    {
        this.fitness = fitness;
    }
}

The code is compiling but getting runtime error.

Exception in thread "main" java.lang.VerifyError: (class: ea/Individual, method: <init> signature: (I)V) Constructor must call super() or this()

In another class, where Individual class is being used:

ArrayList<Individual> pop = new ArrayList<Individual>();

This where Individual class is being intantiated:

Individual temp = new Individual(STRING_SIZE);
pop.add(temp);

EDIT

I haven’t renamed the file manually. All the coding was done in Netbeans. The only problem is when I am creating instance of Individual.

EDIT2

I have copied the project another place, everything is normal again. probably a bug of Netbeans or JDK

  • 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-27T18:30:11+00:00Added an answer on May 27, 2026 at 6:30 pm

    You should javap the .class file and check whether the compiler generated a call to super() near the start of your constructor.

    The JVM verifier requires that any constructor (other than for Object, of course) invoke (possibly indirectly via another constructor) it’s superclass’s constructor. Normally the compiler inserts a call to the superclass constructor automatically if you don’t do it, but it’s possible that it could be confused into not doing this under some circumstances (though the code presented doesn’t seem that complex).

    (And, yes, you have this and ind swapped in most places in copy.)

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

Sidebar

Related Questions

Not exactly sure how to look this up, but I'm not finding the solution
So I have searched for this but not finding anything about it and if
I know this isn't a unique issue but I've not had much luck finding
A quick question, for a quick answer (since I'm not finding any): Is there
I'm not sure why finding any frameworks or good example projects for developing windows
I wonder, why the hell... did the VS team consider that NOT finding a
There are already a couple of questions on finding cycles, but I did not
Sometimes I have come across this issue that whenever I change the order of
I'm new to jQTouch -- it's pretty awesome -- but I'm finding that I'm
I am not finding any great examples online and so am asking an easy

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.