0

Error: Main method not found in class Arrays.C, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

Although am having a main method, am getting this kind of error.
the code is as follows.....

package Arrays;

public class C {

    public static void main(String[] args) {
        // TODO Auto-generated method stub


        int a[][]={{1,3,4},{3,4,5}};  
        int b[][]={{1,3,4},{3,4,5}}; 
        int c[][]=new int[2][3];  
        for(int i=0;i<2;i++)
        {  
            for(int j=0;j<3;j++)
            {  
                 c[i][j]=a[i][j]+b[i][j];  
                System.out.print(c[i][j]+" ");  
            }  
            System.out.println();
        }
    }

}
azurefrog
  • 9,994
  • 7
  • 36
  • 51
Venkat Gurrala
  • 1
  • 1
  • 1
  • 1
  • 1
    Please make sure that you are executing the program from a correct directory. – Karan Oct 23 '17 at 17:20
  • It looks like you're making a JavaFX Application when you should be creating a standard Java Application. The build configuration is most likely expecting the main / launch method to be in a subclass of `Application` as a result. Make a new project which is a 'Java Application', then move your code across and try again. – d.j.brown Oct 23 '17 at 17:27
  • Make sure you have not created a class called `String`. – Mark Rotteveel Sep 05 '20 at 06:56

2 Answers2

0

javac -d . -classpath .;Arrays.jar C.java

java -classpath .;Arrays.jar Arrays.C

Ashim Paul
  • 90
  • 2
0

It runs fine for me. Try this in eclipse: File > New > Java Project. Create a new Class called C in the src folder. Run

Brent Sandstrom
  • 801
  • 8
  • 16