'java'에 해당되는 글 16건

  1. 2013.04.13 [IT][여러가지 언어들의 hello world]
[IT]/컴퓨터2013.04.13 06:35

 

 

[IT][여러가지 언어들의 hello world]

프로그램을 처음 배울 때 접하는 Hello, world!
Brian Kernighan 이 1973년에 쓴 A Tutorial Introduction to the Language B 에서 가장 먼저 등장했다.
 

//----------------------------------  C
#include <stdio.h>
int main()
{
  printf("Hello, world!\n");
  return 0;
}
 

//----------------------------------  C++
#include <iostream>
using namespace std;
int main()
{
  cout << "Hello, world!" << endl;
  return 0;
}
 

//----------------------------------  Basic
10 PRINT "Hello, world!"
 

//----------------------------------  PASCAL
program Hello;

begin
  Writeln('Hello, World!');
end.
 

//----------------------------------  Java
class HelloWorld

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

//----------------------------------  Fortran
      PROGRAM HELLOWORLD
      WRITE (*,100)
      STOP
  100 FORMAT (' Hello, World! ' /)
      END
 

//----------------------------------  Fortran77
PROGRAM HELLOWORLD
PRINT*, 'Hello World!'
END
 

//----------------------------------  C#
using System;

class HelloWorld
{
  public static int Main(String [] args)
  {
    Console.WriteLine("Hello, World!");
    return 0;
  }
}
 

//----------------------------------  Python
print "Hello, World!"
 

//----------------------------------  HTML
<html>
<body>
  Hello world!
</body>
</html>
 

//----------------------------------  Active Server Pages(ASP)
<%
  Response.write "Hello, world!"
%>
 

//----------------------------------  Perl
print "Hello, World!\n"
 

//----------------------------------  AWK
BEGIN{print "Hello, World!"}
 

//----------------------------------  Cobol
IDENTIFICATION DIVISION.
   PROGRAM-ID. HELLOWORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MELONG.
       DISPLAY "Hello, world!".
       STOP RUN.
 

//----------------------------------  Java Server Pages(JSP)
<%="Hello world!" %>
 

//----------------------------------  MS-DOS(batch)
@echo off
echo Hello, world!
 

//----------------------------------  sh(unix shell)
#/bin/sh
echo 'Hello, world!'
 

//----------------------------------  B
main( ) {
  extrn a, b, c;
  putchar(a); putchar(b); putchar(c); putchar('!*n');
}

a 'Hell';
b 'o, w';
c 'orld';
 

//----------------------------------  Object-Oriented C
#import <stdio.h>

@interface Hello : Object
{
   const char str[] = "Hello, world!";
}
- (id) hello (void);
@end

@implementation Hello
- (id) hello (void)
{
   printf("%s\n", str);
}
@end

int main(void)
{
   Hello *h = [Hello new];
   [h hello];
  
   [h free];
   return 0;
}
 
<참고>
신이 http://blog.naver.com/kurishin/60018856018

 

 

저작자 표시
신고
Posted by 제임스구 jamesku

티스토리 툴바