Fundamentals 4 min read

Hello World Examples in 12 Popular Programming Languages

This article showcases the correct "Hello World" syntax for twelve widely used programming languages, providing clear code snippets and brief explanations to help beginners understand the fundamental first program across Java, C, Python, C++, C#, Visual Basic .NET, JavaScript, PHP, Objective‑C, SQL, Ruby, and MATLAB.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Hello World Examples in 12 Popular Programming Languages

As a programmer, the first program you usually write is the classic "Hello World". This article presents the proper "Hello World" implementation for twelve popular programming languages, based on rankings from GitHub and Tiobe, and includes the source code for each example.

1. Java

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

2. C

#include<stdio.h>

int main(void) {
    printf("Hello, world!");
    return 0;
}

3. Python

print('Hello World')

4. C++

#include <iostream>
using namespace std;

int main() {
    cout << "\nHello World" << endl;
    return 0;
}

5. C#

using System;

namespace helloWorld {
    class HelloWorld {
        static void Main(string[] args) {
            Console.WriteLine("Hello World!");
        }
    }
}

6. Visual Basic .NET

Module HelloWorld
   Sub Main()
      System.Console.WriteLine("Hello world!")
   End Sub
End Module

7. JavaScript

console.log("Hello World");

8. PHP

&lt;?php
// In PHP, we use echo to print text
echo "Hello World";
// If you want to print in browser's console, we use print_r
print_r("Hello World");
// To also show variable data types, use var_dump
$stringVar = 'hello world';
var_dump($stringVar);
?&gt;

9. Objective‑C

#import &lt;Foundation/Foundation.h&gt;
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"Hello World!");
    }
    return 0;
}

10. SQL

SELECT 'Hello World';
PRINT 'Hello World';

11. Ruby

puts 'Hello World'

12. MATLAB

fprintf(1, 'Hello, world!');
quit

All example code is taken from the open‑source repository https://github.com/blackbird71SR/Hello-World . Readers are encouraged to contribute additional languages to the collection.

JavaPythonC++code examplesProgramming BasicsHello World
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.