Search code examples
javamain-method

Main class is not being found when I run my project on eclipse neon


I am trying to run my project, but the main class isn't being found. Whats wrong? Here's my code.

public class ArrayPrinter {
    public static void printArray(int[] arr) {
    int size = arr.length;
System.out.print("[");
    for(int i=0;i< size; i++){
        System.out.print(arr[i]);
           if(i<size-1){
         System.out.print(",");
        }
    }
    System.out.println("]");
}

}

Solution

  • The signature of the main function always looks the same:

     public class ArrayPrinter {
    
        public static void main(String[] args) {
           // put code here
        }
    
        public static void printArray(int[] arr) {
        int size = arr.length;
    System.out.print("[");
        for(int i=0;i< size; i++){
            System.out.print(arr[i]);
               if(i<size-1){
             System.out.print(",");
            }
        }
        System.out.println("]");
    }
    
    }