Java console program

前端 未结 6 1848
花落未央
花落未央 2021-02-01 15:30

I was wondering how to make a Java console program. I use Eclipse as IDE. Looking for something similar to C#\'s version of a console program.

Tried Google but only foun

6条回答
  •  佛祖请我去吃肉
    2021-02-01 16:23

    /*
     * put this in a file named CommandLineExample.java
     *
     */
    
    class CommandLineExample
    {
        public static void main ( String [] arguments )
        {
            System.out.println("Hello, world");
        }
    }
    

    type the following from the command line to compile it:

    $ javac CommandLineExample.java
    

    then you can run it from the command line like this:

    $ java CommandLineExample
    

提交回复
热议问题