Hi, I have some problem in solving my homework in java language.

I was asked to produce a boolean array and implement some operation.

private boolean[] set; 

How can I add integer into the array list??

thanks

It's impossible to add an integer value into a boolean type array which stores boolean value only.

Hi, first, thanks for your reply.

For this homework, we are given code below:


public class IntegerSet{
private boolean[] set;

.......


}

And we are asked to complete the method below:


public void insert(int i) //adds an integer into the set
public void remove(int i) //removes an integer from the set

so, yeah, i don't know how can I do so.

You don't give enough information to understand what your problem is.

i don't know how can I do so

You can't do it.
As tong1 said, you can NOT put an int value in boolean array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.