Professional Documents
Culture Documents
Programming I - Lab1: 1 First Program - "Hello World"
Programming I - Lab1: 1 First Program - "Hello World"
Save the code and check that a file called Lab1.java has been created in your
computer. Compile and check that a file Lab.class has been created in your
compiter. Finally, execute the code and see the result on the screen.
1
3 Second program - print a triangle
Create a new class called Figures and, in the main, write the following code.
System.out.println(‘‘triangle’’);
System.out.println(‘‘*’’);
System.out.println(‘‘***’’);
System.out.println(‘‘*****’’);
Observe what happens when you execute the code. Write code for printing
a square, and a rectangle. Try to write code that prints other figures. Submit
Figures.java to Moodle.