What is the "Hello World!" Program?

Yusuf Ali
3 min readDec 3, 2023

--

Programming Basics #1

***This is for you if you are new to programming or want to attain fundamental knowledge.***

It was the first program I ever wrote in my life in my first year in college. The "Hello, World!" program is a simple and traditional computer program that introduces beginners to a new programming language. Its purpose is to demonstrate a programming language's basic syntax and structure. The program is often the first program that people write when learning a new programming language as a starting point for understanding the fundamental coding concepts.

The program typically consists of just a few lines of code instructing the computer to output the text "Hello, World!" to the screen. Below are codes for the Hello World program in Java, C & Python.

For the comparison, Python programming is the easiest. It is, and that is why my classmates and I learned Python first, then Java, and then C. Java and C may look a little complicated, but they are easy to know if you try to learn and practice. Let's discuss each code for the Hello World program in Java, C & Python.

"Hello World!" in Java

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

In Java, the program is elementary, illustrating some of the basic
concepts of Java programming.

  1. The first line, public class Main, declares a class called Main. Every line of code that can run in Java must be inside a class.
  2. The second line, public static void main(String[] args), declares a method called main(). The main() method is the entry point for all Java programs, and it is called when the program is run.
  3. The third line, System.out.println("Hello, World!");, prints the string "Hello, World!" to the console.

"Hello World!" in C

#include <stdio.h>

int main() {
printf("Hello, World!\n");
return 0;
}

The "Hello World!" program illustrates some of the basics of C.

  1. The first line, #include <stdio.h>, is a preprocessor directive. It tells the compiler to include the stdio.h header file contains declarations for the printf function and other input/output functions.
  2. The second line, int main(), starts the main function. The main function is the program's entry point, where the program execution begins.
  3. The following line, printf("Hello, World!\n");, calls the printf function to print the string "Hello, World!" to the console. The \n character at the end of the string is a newline character, which causes the cursor to move to the following line.
  4. The last line, return 0;, terminates the main function and returns the value 0 to indicate that the program was completed successfully.

"Hello World!" in Python

print ('Hello World')

In this example, the code uses the print() function in Python to print the string "Hello, World!" to the console. The print() function can be used to print any type of object, including strings, numbers, and lists.

--

--

Yusuf Ali
Yusuf Ali

Written by Yusuf Ali

Graphics | Data | Languages | Movies | Books | Poems | Fiction

No responses yet