Learning Activity Sheet Java (LAS) - 3
Learning Activity Sheet Java (LAS) - 3
Integrity witnesses of faith, upholds our Claretian principle and lives a moral and dignified
life.
Excellence strives for perfection and holiness, pursues academic excellence in achieving
holistic transformation.
Identification.
1. What in Netbeans?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
2. What is Eclipse?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
3. What is BlueJ?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
4.What is DrJava?
____________________________________________________________________________________
____________________________________________________________________________________
_________________________________________________________________________________
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
2. Click on the FREE JAVA DOWNLOAD button. It will take you to this screen:
3. Click on the AGREE AND START FREE DOWNLOAD button. When your
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Java download is complete, you have to close all your browsers and reload them to enable
the Java installation.
4. Run the downloaded file and you will get the screen below. Just click the INSTALL button.
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
3. The next page will ask you to choose the version of Java SE Development Kit you want
to download. Make sure you know exactly what operating system you have in your
computer or laptop before you start downloading.
4. To check the version of your operating system, you can go to the SYSTEMS or PC
INFO settings of your computer/laptop.
5. Open the downloaded program to complete the installation of your Jave SE Development
Kit. Ensure that you read and follow the steps carefully.
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Then;
1. Goto the website http://eclipse.org/downloads by typing this in the address bar of your
web browser. It will take you to the screen below:
2. Choose the appropriate version of Eclipse based on your computer’s operating system. For
a 64-bit Windows operating system (OS), you will get the screen below:
3. After downloading, open the program and you will get the screen below:
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
4. Just choose ECLIPSE IDE FOR JAVA DEVELOPERS option and then click the INSTALL
button. Make sure you accept the ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT.
After downloading the programs, make sure you test your installed software. You can follow these
steps to test Eclipse:
Launch Eclipse. You should be able to see an ECLIPSE JAVA MARS icon on the
desktop. It will then ask you to SELECT A WORKSPACE. Just leave what is inside
the boxand then click the OK button.
Create a new Java project by going to the menu on top: FILE > NEW > JAVA PROJECT
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Modify the new Displayer.java file by entering the following lines of code in the Editor
pane.
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Execute Displayer.java by clicking on this button located at the top and check to make
sure that the output reads Hello Java! By checking the figure below.
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Below are the different tools needed in Java programming that can be downloaded online
for free:
Compiler
A compiler turns the Java code you write into something that can be understood and run on your
computer. Computers do not comprehend instructions same like humans. For example, check the
program code below:
Looking for an available rental car:
This basic Java code searches for any available rental car or vehicle for a certain client, assuming that
the company has 99 cars in total. You cannot run this code by just typing as it is. However, ignoring the
strange punctuations and typing format, human beings are able to grasp what it wants the computer to
do:
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
Set the rental car number to 1.
As long as the rental car number is less than 100,
Check the number of clients that rented the car.
If the number of clients that rented the car is 0, then
report that the car is available,
and stop.
Otherwise,
prepare to check the next car by
adding 1 to rental car number.
If you get to the non-existent rental car number 100, then
report that all cars or vehicles were rented out.
As for computers, they do not follow English-translated instructions to do a specific task. Instead, they
understand cryptic Java bytecode commands. This is where the compiler comes in. After writing your
Java source code, it is being translated and written by the compiler into Java bytecodes that the computer
can execute. Check bytecode counterpart below for the same Java code:
aload_0
iconst_1
putfield Company/ rentalcarNum I
goto 32
aload_0
getfield Company/client [I
aload_0
getfield Company/rentalcarNum I
iaload
ifne 26
getstatic java/lang/System/out Ljava/io/PrintStream;
new java/lang/StringBuilder
dup
ldc ” Car “
invokespecial java/lang/StringBuilder/<init>(Ljava/lang/String;)V
aload_0
getfield Company/rentalcarNum I
invokevirtual java/lang/StringBuilder/append(I)Ljava/lang/StringBuilder;
ldc ” is available.”
invokevirtual
java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invokevirtual java/lang/StringBuilder/toString()Ljava/lang/String;
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
iconst_0
invokestatic java/lang/System/exit(I)V
goto 32
aload_0
dup
getfield Company/rentalcarNum I
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
iconst_1
iadd
putfield Company/rentalcarNum I
aload_0
getfield Company/rentalcarNum I
bipush 100
if_icmplt 5
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc ” All cars or vehicles are rented out”
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
The source code can be saved in a file named Company.java and the compiler probably puts the Java
bytecode in another file named Company.class. You even need a tool to display a text-like version of a
Java bytecode file (you can use Ando Saabas’s Java Bytecode Editor). If you try open the code of the
Company.class file using Notepad or even Microsoft Word, you will only see gibberish characters like
dots, squiggles and more.
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)
Claret College of Isabela
Senior High School
P.O. Box 8692 Roxas Avenue, Isabela City, Basilan Province, 7300 Philippines
Tel. No. (062) 200 - 7697 / 200 – 7009 Telefax: (062) 200 - 3865
NAME:___________________________________________DATE: _______________
COURSE AND YEAR: ______________________________OUTPUT NO: ____3
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
2. What is Compiler?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
3. What is Interpreter?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
EVALUATE:
Learning/Activity Sheet
(APPLY PROGRAMMING SKILL IN JAVA- SARDUAL)