question01

Top  Previous  Next

In Java, we print a "Hello, World!" to the console, something like this:

 

public class Main {

    public static void main(String[] args) {

        System.out.println("Hello, World!");

    }

}

public again means that anyone can access it.

static means that you can run this method without creating an instance of Main.

void means that this method doesn't return any value.

main is the name of the method.

The arguments we get inside the method are the arguments that we will get when running the program with parameters. It's an array of strings.

 

tipbulbCreate a program similar that prints "Hello, World!" to the console using Smart Pascal.

 

mytoggle_plus1See the solution:

type

  ConsoleApp = class

  public

    class method Main(args: array of String);

  end;

 

implementation

 

{ ConsoleApp }

class method ConsoleApp.Main(args: array of String);

begin

  // add your own code here

  WriteLn('Hello World.');

end;

 

{...}

 

ConsoleApp.Main([]);

//Hello World.