Hello world! Examples of different languages

Here is one for Java:




/*************************************************************************
 *  Compilation:  javac HelloWorld.java
 *  Execution:    java HelloWorld
 *
 *  Prints "Hello, World". By tradition, this is everyone's first program.
 *
 *  % java HelloWorld
 *  Hello, World
 *
 *  These 17 lines of text are comments. They are not part of the program;
 *  they serve to remind us about its properties. The first two lines tell
 *  us what to type to compile and test the program. The next line describes
 *  the purpose of the program. The next few lines give a sample execution
 *  of the program and the resulting output. We will always include such 
 *  lines in our programs and encourage you to do the same.
 *
 *************************************************************************/

public class HelloWorld {

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

}






Please feel free to post other examples.

Re: Hello world! Examples of different languages




/* Hello World program in C*/


#include<stdio.h>


main()
{
    printf("Hello World");


}



Re: Hello world! Examples of different languages



#python 3 hello world example
print("Hello, World!")


Re: Hello world! Examples of different languages

I wanted to do C :bummer:

Re: Hello world! Examples of different languages

I'll try C++ . Been 12 yrs since I did that, but well, I'll give it a try.

include

Void main()
{
cout <<"Hello World";
}
PS: correct me if I'm wrong.

Re: Hello world! Examples of different languages

HTML



<br> Hello World!<br>

Re: Hello world! Examples of different languages

Was "PS correct me if I am wrong" part of the code?

Re: Hello world! Examples of different languages

Assembly language — MOS Technology 6502, Apple II (II+, IIe, IIC)



; Uses S-C Assembler variant.
; .or is origin
; .as is ASCII String
; .hs is Hex String
        .or $300
main    ldy #$00
.1      lda str,y
        beq .2
        jsr $fded ; ROM routine, COUT, y is preserved
        iny
        bne .1
.2      rts
str     .as "HELLO WORLD"
        .hs 0D00



Re: Hello world! Examples of different languages

:hehe: no

Re: Hello world! Examples of different languages

Backbone.js



<!DOCTYPE html>
<html>
<head>
<**** charset="utf-8">
<title>hello-backbonejs</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script src="https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js"></script>
<script src="http://underscorejs.org/underscore.js"></script>
<script src="http://backbonejs.org/backbone.js"></script>
 
<script>
(function($){
  var MyView = Backbone.View.extend({
     initialize: function(){ 
       this.render(); 
    },
    render: function(){
      $('body').append("<h4>hello world</h4>");
    }
  });
  var myView = new MyView();
  var myView = new MyView();
})(jQuery);
</script>
<div>test</div>
</body>
</html>


Re: Hello world! Examples of different languages

NodeJS




console.log('Hello World!!');



PHP




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



C#




using System;

public class hello
{
 public static void main(){
 console.WriteLine("hello world!!");
}
}



Re: Hello world! Examples of different languages

JavaScript




<script>
alert('Hello World');
</script>



Re: Hello world! Examples of different languages

COBOL



IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO-WORLD.
       PROCEDURE DIVISION.
           DISPLAY 'Hello, world!'.
           STOP RUN.



Re: Hello world! Examples of different languages

Objective-C



#import <stdio.h>
#import <Foundation/Foundation.h>

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


Re: Hello world! Examples of different languages

*sh & dos



echo "hello world!";

perl ( hope not a repeat )


print "Hello World!";
print "
";


FORTRAN: ( yeah..used that when I was a chemical engineer )


!program hello
print *, 'Hello World'
end program hello

Re: Hello world! Examples of different languages

English
"Hello World"

Russian
"привет мир"

:)

Re: Hello world! Examples of different languages

Pascal:




program HelloWorld;

begin
  WriteLn('Hello, world!');
end.



Re: Hello world! Examples of different languages

PL/SQL




SET SERVEROUTPUT ON;
BEGIN
    DBMS_OUTPUT.PUT_LINE('Hello, world!');
END;



Re: Hello world! Examples of different languages

Ruby:




puts "Hello, world!"



Re: Hello world! Examples of different languages

Ahan, Even though its just hello world, looks like we've got some serious programmers here now on GS :)

now we are talking ;)