{"id":447,"date":"2017-12-09T07:46:33","date_gmt":"2017-12-09T07:46:33","guid":{"rendered":"http:\/\/www.afternerd.com\/blog\/?p=447"},"modified":"2017-12-09T07:47:17","modified_gmt":"2017-12-09T07:47:17","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/www.afternerd.com\/blog\/hello-world\/","title":{"rendered":"How a hello world program looks like in 5 programming languages"},"content":{"rendered":"<p>If you don&#8217;t know what a hello world program is, let me explain.<\/p>\n<p>It is a very simple program that is meant to be the first program you write when you start learning a new programming language.<\/p>\n<p>The program itself does nothing more than printing a &#8220;Hello World&#8221; text on the screen.<\/p>\n<p>In this article, I am going to show you how a hello world program looks like in 5 very widely used programming languages.<\/p>\n<h2>1- Hello world in Python<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-454\" src=\"http:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-300x300.png\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-300x300.png 300w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-150x150.png 150w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-768x768.png 768w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-1024x1024.png 1024w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-66x66.png 66w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-200x200.png 200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-400x400.png 400w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-600x600.png 600w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-800x800.png 800w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python-1200x1200.png 1200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/python.png 2000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Python is a programming language that dates back to the late 80s.<\/p>\n<p>It&#8217;s a popular language because it&#8217;s very easy to learn.<\/p>\n<p>Due to its readability and simplicity, python is usually the programming language of choice for freshman CS students.<\/p>\n<p>Recently, <a href=\"https:\/\/stackoverflow.blog\/2017\/09\/06\/incredible-growth-python\/\" target=\"_blank\" rel=\"noopener\">Python&#8217;s even gained more popularity<\/a> because of the booming fields of machine learning and data science.<\/p>\n<p>Talking of simplicity, here is how a python hello world looks like:<\/p>\n<pre class=\"prettyprint\"><code>print(\"Hello, World!\")<\/code><\/pre>\n<p>Some of the popular open source projects written in python are <a href=\"https:\/\/github.com\/scikit-learn\/scikit-learn\" target=\"_blank\" rel=\"noopener\">scikit-learn<\/a> and <a href=\"https:\/\/github.com\/django\/django\" target=\"_blank\" rel=\"noopener\">Django<\/a><\/p>\n<h2>2- Hello world in Java<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-453\" src=\"http:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/java-164x300.png\" alt=\"\" width=\"164\" height=\"300\" srcset=\"https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/java-164x300.png 164w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/java-200x367.png 200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/java-400x733.png 400w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/java.png 419w\" sizes=\"(max-width: 164px) 100vw, 164px\" \/><\/p>\n<p>Without a doubt, Java is a very widely used programming language.<\/p>\n<p>Started by Sun Microsystems in 1991 before Sun was acquired by Oracle.<\/p>\n<p>Here is how a hello world program looks like in java<\/p>\n<pre class=\"prettyprint\"><code>public class HelloWorld {\r\n    public static void main(String[] args) {\r\n        System.out.println(\"Hello, World\");\r\n    }\r\n}<\/code><\/pre>\n<p>Some of the open source Java projects that I like are <a href=\"https:\/\/github.com\/elastic\/elasticsearch\" target=\"_blank\" rel=\"noopener\">elasticsearch<\/a> and <a href=\"http:\/\/hadoop.apache.org\/\" target=\"_blank\" rel=\"noopener\">Hadoop<\/a><\/p>\n<h2>3- Hello world in C<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-450\" src=\"http:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-282x300.png\" alt=\"\" width=\"282\" height=\"300\" srcset=\"https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-282x300.png 282w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-768x817.png 768w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-963x1024.png 963w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-200x213.png 200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-400x425.png 400w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-600x638.png 600w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C-800x851.png 800w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/C.png 1200w\" sizes=\"(max-width: 282px) 100vw, 282px\" \/><\/p>\n<p>C is one of the oldest programming languages dating back to the 70s.<\/p>\n<p>It is still very widely used and is not going away any time soon.<\/p>\n<p>Despite the fact that it&#8217;s relatively harder to learn,\u00a0it gives developers full control over the system.<\/p>\n<p>Here is how to write a hello world program in C<\/p>\n<pre class=\"prettyprint\"><code>#include \"stdio.h\"\r\n\r\nmain()\r\n{\r\n    printf(\"Hello, World\");\r\n}<\/code><\/pre>\n<p>The most popular piece of code ever written in C, in my opinion, is the <a href=\"https:\/\/github.com\/torvalds\/linux\" target=\"_blank\" rel=\"noopener\">Linux operating system<\/a>.<\/p>\n<h2>4- Hello world in Go<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-452\" src=\"http:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-220x300.png\" alt=\"\" width=\"220\" height=\"300\" srcset=\"https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-220x300.png 220w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-768x1045.png 768w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-752x1024.png 752w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-200x272.png 200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-400x544.png 400w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-600x817.png 600w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-800x1089.png 800w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang-1200x1633.png 1200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/golang.png 1634w\" sizes=\"(max-width: 220px) 100vw, 220px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Go is a new programming language that was created by Google in 2009.<\/p>\n<p>I am a little biased because this the language I use for my work on a daily basis \ud83d\ude42<\/p>\n<p>It combines the control and power you have in C with the readability and simplicity of Python.<\/p>\n<p>It definitely makes me happy to know that the language is <a href=\"https:\/\/www.infoworld.com\/article\/3208904\/application-development\/go-language-soars-to-new-heights-in-popularity.html\" target=\"_blank\" rel=\"noopener\">rapidly growing day after day<\/a>.<\/p>\n<p>Here is the code for writing a hello world in Go.<\/p>\n<pre class=\"prettyprint\"><code>package main\r\nimport \"fmt\"\r\nfunc main() {\r\n    fmt.Println(\"hello world\")\r\n}<\/code><\/pre>\n<p>Some of the popular open source projects written in Go are <a href=\"https:\/\/github.com\/moby\/moby\">docker<\/a> (now moby), <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\" target=\"_blank\" rel=\"noopener\">kubernetes<\/a>, and <a href=\"https:\/\/github.com\/ethereum\/go-ethereum\" target=\"_blank\" rel=\"noopener\">ethereum<\/a>.<\/p>\n<h2>5- Hello world in C#<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-451\" src=\"http:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-279x300.png\" alt=\"\" width=\"279\" height=\"300\" srcset=\"https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-279x300.png 279w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-768x825.png 768w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-953x1024.png 953w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-200x215.png 200w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-400x430.png 400w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-600x645.png 600w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp-800x860.png 800w, https:\/\/www.afternerd.com\/blog\/wp-content\/uploads\/2017\/12\/csharp.png 1044w\" sizes=\"(max-width: 279px) 100vw, 279px\" \/><\/p>\n<p>C# was created by Microsoft to rival Java, and in all honesty it lost the battle.<\/p>\n<p>Not as widely used as the other languages in the list but still used in some companies.<\/p>\n<p>If you end up working for Microsoft or you are developing software to run primarily on Windows, you will probably use C# on top of the .NET framework.<\/p>\n<p>Here is how to write a hello world program in C#<\/p>\n<pre class=\"prettyprint\"><code>using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\nnamespace ConsoleApplication1\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            Console.WriteLine(\"Hello, world!\");\r\n        }\r\n    }\r\n}<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>That&#8217;s it folks. Have fun programming! \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":456,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[13],"yst_prominent_words":[161,146,147,170,89,90,168,174,171,166,53,178,177,176,169,175,155,173,172,167],"_links":{"self":[{"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/posts\/447"}],"collection":[{"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/comments?post=447"}],"version-history":[{"count":6,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/posts\/447\/revisions"}],"predecessor-version":[{"id":459,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/posts\/447\/revisions\/459"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/media\/456"}],"wp:attachment":[{"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/media?parent=447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/categories?post=447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/tags?post=447"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.afternerd.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}