Hello world!
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
pe februarie 18, 2008 pe 1:09 pm
Cool! I’ve learned most of these languages, except C and Basic. Never plan on learning Basic and I wonder what it’s good for, :p.
pe februarie 19, 2008 pe 3:22 pm
basic was a lot of fun in the old days. It was the first language i’ve learnt.
I wonder if it’s still in use?
C is one of my favourite languages, sadly I never got around to doing a lot of C++ coding
pe februarie 19, 2008 pe 10:48 pm
Linux uses a lot of C++ and unfortunately I haven’t learned C++ in depth. I would like to know more C or C++, but I’m pretty much stuck with Java now.
Happy coding!