C Hello World
Steps | Example |
1. Create a file with the .c extension using vi. |
$ vi hello_world.c |
2. Insert hello world code into the file. |
#include<stdio.h> |
3. Compile the program via the make command. Note that the hello_world.c file must exist in the directory for this step to work. |
$ make hello_world |
4. Run the compiled C file created in the last step. If done correctly, "Hello World!" should be output to the terminal screen. |
$ ./hello_world |
C++ Hello World
Steps | Example |
1. Create a file with the .cpp extension using vi. |
$ vi hello_world.cpp |
2. Insert hello world code into the file. |
#include <iostream> |
3. Compile the program via the g++ command. This will create the a.out file for execution. |
$ g++ hello_world.cpp |
4. Run the compiled C++ file created in the last step. If done correctly, "Hello World!" should be output to the terminal screen. |
$ ./a.out |
Python Hello World
Steps | Example |
1. Create a file with the .py extension using vi. |
$ vi hello_world.py |
2. Insert hello world code into the file. |
print("Hello World!") |
3. Execute the program using the python command. |
$ python hello_world.py |
Java Hello World
Steps | Example |
1. Create a file with the .java extension using vi. |
$ vi HelloWorld.java |
2. Insert hello world code into the file. |
public class HelloWorld { |
3. Compile the program with the javac command |
$ javac HelloWorld.java |
4. Execute the program with the java command. The output will be printed to the terminal screen. |
$ java HelloWorld |