Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is my Java code:

public class MainClass {

    /**

     * @param args

     */

    public static void main(String[] args){

        char c = args[0].charAt(0);

        char c1 = (char)(c + 1);

        System.out.println(c + "\t" + c1);

    }

}

When I try to compile it in Eclipse, I get the below error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at MainClass.main(MainClass.java:9)

Can anyone tell me how to Run a Simple Java Program in Eclipse?

1 Answer

0 votes
by (19.7k points)

Follow the below steps:

  1. Go to menu ----> Run  Configurations ------> Run

  2. On the left ---> search for your project in the list

  3. On the right ----? Select the "Arguments" tab.

  4. In the “Program arguments”, write the augment you need to pass

  5. Click ‘Run’.

Interested in Java? Check out this Java tutorial by Intellipaat.

Related questions

0 votes
1 answer
asked Feb 18, 2021 in Java by sheela_singh (9.5k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...