Linux assignment 6


Assignment given by Tero Karvinen

a) Kirjoita ja suorita “Hei maailma” kolmella kielellä. Asenna tarvittavat ympäristöt.

b) (vapaaehtoinen) Kirjoita kullakin kielellä yksinkertainen ohjelma, jolla on jokin käyttötarkoitus. Ideoita: hyödynnä kielen vahvuuksia. Ota käyttäjältä syöte, tee jokin lasku ja tulosta vastaus (input-processing-output).

Hello World

a) In this assignment I had to write “Hello world” in 3 different code language.

Before doing this assignment I had to decide which language I would use. I chose Java, Python and Javascript.

Firstly I made a folder for all these so I could find them. I made a folder with “mkdir HelloWorld”. Then I started doing the assignments.


First I had to install java. Instructions that I used to install java you can read here. Java I installed using command:

$ sudo apt-get install openjdk-8-jdk

Then I did a new file with:

$ nano

Hello java.png

Then I change the .java ending jo .class ending so I can run it as a java program.

$ javac

Then I executed the java file

$ java HelloWorld

This was the result:

java run.png


For running javascript you need program called node. Instructions used for installation you can find here. For installing node I used command:

$ sudo apt-get install nodejs

With this command it also installed the correct npm -version. (You can check your node and npm version with node -v and npm -v).

The I made file which had .js ending:

$ nano HelloWorld.js

hello js.png

After I created the file I executed it:

$ nodejs helloworld.js

This was the result:

nodejs hello.png


For this assignment I installed iPython3 that was recommended by my teacher Tero Karvinen.

$ sudo apt-get install python3

$ sudo apt-get insatll ipython3

You could do with both but I use with what I feel like. One is better for something else and other one is better for something else.

I made new file with .py endin:

$ nano

hello py.png

Then I needed to executed the file:

$ python3

And the result was:

python3 hello.png


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s