Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Graphical User Interfaces  














"Hello, World!" program






العربية
Asturianu
Azərbaycanca

Беларуская
Български
Boarisch
Bosanski
Català
Čeština
Dansk
Deutsch
Eesti
Ελληνικά
Español
Esperanto
Euskara
فارسی
Français
Galego

Հայերեն
ि
Hrvatski
Bahasa Indonesia
Interlingua
Italiano
עברית


Latviešu
Lëtzebuergesch
Magyar
Македонски


Bahasa Melayu
Minangkabau
Nederlands

Norsk bokmål
Norsk nynorsk
Oʻzbekcha / ўзбекча
Polski
Português
Qaraqalpaqsha
Română
Русский
Саха тыла
Scots
Shqip
Simple English
Slovenčina
Slovenščina
کوردی
Српски / srpski
Srpskohrvatski / српскохрватски
Suomi
Svenska
ி

Тоҷикӣ
Türkçe
Українська
اردو
Tiếng Vit



 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




Print/export  







In other projects  



Wikimedia Commons
Wikiversity
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


This is an old revision of this page, as edited by 172.142.134.79 (talk)at05:01, 8 September 2002 (Added Eiffel). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff)  Previous revision | Latest revision (diff) | Newer revision  (diff)

AHello world program is the name of a program that simply prints out "Hello world!".

This is a traditional first program to write when learning a new programming language, and can be a useful sanity test to make sure that a language's development environment and run-time environment are correctly installed.

While minimal test programs such as this existed since the development of programmable computers, the tradition of using "Hello world!" as the test message was probably started by its use as an example program in the book The C Programming Language, by Brian Kernighan and Dennis Ritchie.

Here are some examples in different languages:

   with Ada.Text_Io; use Ada.Text_Io;
   procedure Hello is
   begin
      Put_Line ("Hello world!");
   end Hello;
   MODEL SMALL
   IDEAL
   STACK 100H
   DATASEG
       HW      DB      'Hello, World!$'
   CODESEG
       MOV AX, @data
       MOV DS, AX
       MOV DX, OFFSET HW
       MOV AH, 09H
       INT 21H
       MOV AX, 4C00H
       INT 21H
   END
   PRINT "Hello world!"
   GET "LIBHDR"
   LET START () BE
   $(
       WRITES ("Hello World!*N")
   $)               
   ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<
   +++++++++++++++.>.+++.------.--------.>+.>.
   #include <stdio.h>
   int main(void)
   {
       printf("Hello world!");
       return 0;
   }
   #include <iostream>
   int main()
   {
       std::cout << "Hello world!" << std::endl;
       return 0;
   }
   IDENTIFICATION DIVISION.
   PROGRAM-ID.     HELLO-WORLD.
   ENVIRONMENT DIVISION.
   DATA DIVISION.
   PROCEDURE DIVISION.
   DISPLAY "Hello, World".
   STOP RUN.
   (format t "Hello world!~%")
   class HELLO_WORLD
   creation
       make
   feature
       make is
       local
               io:BASIC_IO
       do
               !!io
               io.put_string("%N Hello World!!!!")
       end -- make
   end -- class HELLO_WORLD


   .( Hello world!)
  PLEASE DO ,1 <- #13
  DO ,1 SUB #1 <- #238
  DO ,1 SUB #2 <- #112
  DO ,1 SUB #3 <- #112
  DO ,1 SUB #4 <- #0
  DO ,1 SUB #5 <- #64
  DO ,1 SUB #6 <- #238
  DO ,1 SUB #7 <- #26
  DO ,1 SUB #8 <- #248
  DO ,1 SUB #9 <- #168
  DO ,1 SUB #10 <- #24
  DO ,1 SUB #11 <- #16
  DO ,1 SUB #12 <- #158
  DO ,1 SUB #13 <- #52
  PLEASE READ OUT ,1
  PLEASE GIVE UP
   public class Hello {
       public static void main(String[] args) {
           System.out.println("Hello world!");
       }
   }
   import java.applet.*;
   import java.awt.*;
   public class HelloWorld extends Applet {
     public void paint(Graphics g) {
       g.drawString("Hello, world!", 20, 20);
     }
   }
   program Hello;
   begin
       writeln('Hello world!');
   end.
   print "Hello world!";
   <?php
       echo "Hello world!";
   ?>
   Test: procedure options(main);
      declare My_String char(20) varying initialize('Hello, world!');
      put skip list(My_String);
   end Test;
   print "Hello world!"
   print "Hello world!"
   Transcript show: 'Hello world!'
   SELECT 'Hello world!' FROM DUAL;
   put "Hello world!"
   MsgBox "Hello, world!"

Graphical User Interfaces

Libraries and APIs are also frequently tested by means of "Hello, world" programs. For example, a GUI library can be tested by a program that draws a window with the text "Hello, world." Here is an example of a standalone Java application that does this (which is necessarily more complex than an applet or simple text application):

   import java.awt.*;
   import java.awt.event.*;
   public class HelloFrame extends Frame {
     HelloFrame(String title) {
       super(title);
     }
     public void paint(Graphics g) {
       super.paint(g);
       java.awt.Insets ins = this.getInsets();
       g.drawString("Hello, World!", ins.left + 25, ins.top + 25);
     }
     public static void main(String args [])
     {
       HelloFrame fr = new HelloFrame("Hello");
       fr.addWindowListener(
         new WindowAdapter() {
           public void windowClosing(WindowEvent e)
           {
             System.exit( 0 );
           }
         }
       );
       fr.setResizable(true);
       fr.setSize(500, 100);
       fr.setVisible(true);
     }
   }

Many more examples can be found at Hello, World Page!.


See also: Just another Perl hacker


Retrieved from "https://en.wikipedia.org/w/index.php?title=%22Hello,_World!%22_program&oldid=303023"





This page was last edited on 8 September 2002, at 05:01 (UTC).

This version of the page has been revised. Besides normal editing, the reason for revision may have been that this version contains factual inaccuracies, vandalism, or material not compatible with the Creative Commons Attribution-ShareAlike License.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki