Is there life beyond the LCD screen?


Hello world!

Publicat în /meFunny de csplusplus pe februarie 6, 2008
Tags: , , , , ,

Basic :

10 PRINT "HELLO WORLD"

Bash

#!/bin/sh
echo hello, world

C
#include
#include

int main(void)
{
printf("Hello, world\n");
return EXIT_SUCCESS;
}

C++
#include

int main()
{
std::cout << "Hello, World." << std::endl;
}

Html – not really a programming language :p

JavaLanguage:

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

Object oriented Java

class Greeting {
void greet(Named target) {
System.out.println("Hello, " + target.getName() + "!");
}
}

interface Named {
String getName();
}

class World implements Named {
String getName() {
return "World";
}
}

class Main {
public static void main( String[] args ) {
Greeting greeting = new Greeting();
greeting.greet(new World());
}
}

Swing Java

public class Hello {
public static void main(String []args) {
JOptionPane.showMessageDialog(null,"Hello, world!");
}
}

JavaApplet:

import java.applet.*;
import java.awt.*;
public class Hello extends Applet {
public void paint(Graphics g) {
g.drawString("Hello World", 25, 50);
}
}

JavaScript:

document.writeln("Hello, World");

Pop up:
alert("Hello, World");

PL/SQL

BEGIN
DBMS_OUTPUT.PUT_LINE('Frank and Beans');
END;

Python

You copy the following text into a file and call the file (hello.py) (remember python is sensitive of it’s indenting, which rocks :) )

print "hello world"
Now invoke the interpreter and pass it your file with the single command: python hello.py