Tuesday, September 18, 2018

Lab 0 (Week 1 13/9/2018)



Today we had first lab for computer programming. We are able to understand the basic of computer components and its function. To be honest, I did not really know the name for each component before even I were using it frequently. A computer includes both hardware and software (program). For example, program is like as recipe and the recipe is the ways (program) to bake a cake (output). This course allows us to understand computer programming which writing instructions that control the hardware in order to perform specific task with the help of programming languages. Computers do not understand human languages, so programs must be written in a language a computer can use such as Java and C++. We use Java throughout these 14 weeks in this course. At first, I learnt how to create folder by using command prompt (cmd). Usually I opened folder by clicking right click on mouse. 



Through first lab, I just realised that we can create folder through cmd. I created “SSK3100” and subsequent inside folder with “LIMXUETING” and “Lab0” by using the command “cd” to the place I would like to locate my folder and command “mkdir (folder’s name) to create the new folder. The steps are very simple as following. 


Next, I typed “notepad” in the cmd and create a simple java program by copying paste code from the document given by lecturer into notepad. After that, I save MyFirstJavaProgram.java in folder “Lab0”.



I tried to install Java into my laptop and set environment variables in java (Path and Classpath) and finally successful. * ENVIRONMENT VARIABLES MUST BE SET IN ORDER TO MAKE SURE JAVA APPLICATION RUN CORRECTLY.


Now, I compiled my java program by typing command “javac MyFirstJavaProgram.java. When I try to compile a java file, it compiles the java file correctly and creates the .class file successfully. But when I try to run the compiled file it gives an error message. It showed “Error: Could not find or load main class MyFirstJavaProgram Caused by: java.lang.ClassNotFoundException: MyFirstJavaProgram”


I tried to edit environment variables in properties permanently but java program still cannot run. At the end, I found another way by using command “set class=C:\Program Files\Java\jdk-10.0.2\bin”; and “set classpath=C:\Program Files\Java\jre-10.0.2\bin”; . “Hello World” was successfully displayed in cmd. However, this way is just for temporary. 


Then, I tried to do again in lab. Now I just realised that we just need to edit the Path with C:\Program Files\Java\jdk-10.0.2\bin and finally successful. 


In short, I am able to know what java programming about and run the simple java program through first lab. I think this course is quite interesting and excited to learn more for the following class. Thank you.

Lim Xue Ting
183615
SSK3100 (Group15)

Next blog: hennyabigail.blogspot.com (Henny Abigailwillyen Sinjus)

Lab 10 (Week 13 13/12/2018)

Heyyy, we had lab 10 which is our last lab. It is about two dimensional array. What is two dimensional array?? Let me explain it ! The e...