首页 > 代码库 > 我见过的几门语言中的hello world

我见过的几门语言中的hello world

1.Java

public class hello {
    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.C++

#include<stdio.h>
int main(void)
{
    printf("hello world!");
    return 0;
} 

4.C#

using System;
namespace hello
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello,world!");
            Console.ReadKey();
        }
    }
}

5.python

print Hello World!  

6.JS

<html>
<body>
<script type="text/javascript">
document.write("Hello World!");
</script>
</body>
</html>

7.PHP

<html>
<body>
<?php
  echo "hello, world!";
?>
</body>
</html>

9.VB.NET

Sub Main()
    Console.WriteLine("Hello world!")
    Console.ReadKey()
 End Sub

10.perl

#!C:\Perl\bin
print "Hello World!";

11.OC

#import <Foundation/Foundation.h>  
int main()  
{  
     NSLog(@"Hello World!");  
     return 0;  
}  

12.Ruby

puts "Hello world!"

13.vb

Private Sub Form_Load()
msbbox ("hello world!")
End Sub

14.Delphi

procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := Hello World!;
end;

15.Pascal

Program HelloWorld(output);  
begin  
  writeln(Hello, world!) 
end.

16.Go

package main
import "fmt"
func main() {
    fmt.Printf("hello world!")
}

17.R

print("Hello,World!")

18.SQL

SQL> select Hello World!from dual; 

19.HTML

<html>  
<body>  
Hello World!  
</body>  
</html>

20.Lua

print"hello world!" 

 

我见过的几门语言中的hello world