import java.util.*;

public class array1
{
	public static void main(String[]args)
	{
      int[] value = new int[1000];

      Scanner keyboard = new Scanner(System.in);

      for (int i = 0; value[i]!= -999 && i < 999; i++)
      {
         System.out.print("Enter number " +
                          (i + 1) + ": ");
         value[i] = keyboard.nextInt();
         	if(value[i] == -999)
         	{
				
         		value=Scan1();
         	    
         		System.out.print(" ");
		    }

      }

   }


public static boolean Scan1(int[] num1)
    {
		int[] A = new int[1000];

			int i, j;
			for (i=0; num1[i] != -999 && i<-999; i++)
			{
					for (j=i+1;num1[j] != -999 && j<-999; j++)
					{
						if (A[i]==A[j])
						return true;

					}
			}return false;
	}
}

i want to calling the public static boolean Scan1(int[] num1) into main but i cannot do it.. can somebody tell me how?

You declared the method like this:
Scan1(int[] num1)
And you are calling it like this:
Scan1()
Something is missing

after i modified the code, im still cannot calling the boolean function.. help somebody!

import java.util.*;
public class array2
{
    public static void main (String[] args)
    {
        boolean duplicate=true;
        int[] numtest;
        int size, num, num1,input;
        size = getArray(0);

        for (int i=0; i< size;i++)
            System.out.print(size +" ");

        num = getList(0);

        duplicate = getduplicate();

        System.out.println("You have enter duplicate number");
            }//main


    public static int getArray(int size)
    {
        Scanner input = new Scanner(System.in);
        size = 0;
        int[] list = new int[size];
        //System.out.println("Enter num :");
        for (int i=0; i< size; i++)
            list[i]=input.nextInt();
        return size;
    }//getArray

    public static int getList(int num)
    {
        Scanner input = new Scanner(System.in);
        int sum = 0, count=0;
        final int FLAG = -999; //end the scan num
        System.out.println("Enter the number end with " + FLAG);
        num = input.nextInt();
        while (num != FLAG)
        {
            count++;
            num=input.nextInt(); // end read the scan num           
        }
        return num;
    }//getList



    public static void getduplicate(int num[])
    {

    boolean found = true;
    boolean flag = false;
    int [] A = new int[1000];
    int i;
    int j = 0;
    for (i=0; i < num.length; i++) {
    {
    if (A[i] == A[j])
    System.out.println("The number is duplicate"+found);
    else if (A[i] != A[j])
    System.out.println("The character is not a !flag"+flag);
    }
    }
    }


}

USE CODE TAGS. And you declare your method with arguments and you are calling it without.

duplicate = getduplicate(); in the main method is without the argument. also in public static void getduplicate(int num[]) change void to int (if you want to return the integer number , as it expects).

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.