Log in / create account | Login with OpenID
DocForge
Programmer's Wiki

Hello World

From DocForge

The "Hello World!" program is quite often the first program a programmer writes in a new language. The program simply prints out the phrase, "Hello World!". This is a simple exercise that teaches the programmer the most basic functionality required to create an application in an unfamiliar language.

Contents

[edit] Bash

A sample "Hello World!" program in a Bash shell script:

#!/usr/bin/sh
echo "Hello World!"

[edit] C++

A sample "Hello World!" program in C++:

#include <iostream>
using namespace std;                      
 
int main()
{
   cout << "Hello World!" << endl;
   return 0;
}

[edit] C

A sample "Hello World!" program in C:

#include <cstdio>
int main()
{
   printf("Hello World!\n");
   return 0;
}

[edit] Java

A sample "Hello World!" program in Java:

public class Hello
{
   public static void main(String args[])
   {
      System.out.println("Hello World!");
   }
}

[edit] Lisp

A sample "Hello World!" program in Lisp:

(print "Hello World!")

[edit] PHP

A sample "Hello World!" program in PHP:

<?php
  echo 'Hello World!';
?>

[edit] Perl

A sample "Hello World!" program in Perl:

#!/usr/bin/perl
print "Hello World!";

[edit] Python

A sample "Hello World!" program in Python:

print 'Hello World!'
Do you have information or insights to contribute to this article? Please feel free to edit this page. Ask questions or contribute to the discussion on this article's talk page.