0% found this document useful (0 votes)
71 views14 pages

Learning Activity Sheet Java (LAS) - 3

1. The document discusses the initial setup needed to begin Java programming, including downloading Java, the Java Development Kit (JDK), Eclipse, and testing a simple "Hello World" program. 2. It provides step-by-step instructions on downloading and installing Java from Oracle's website, downloading and installing the JDK from Oracle, and downloading and installing the Eclipse integrated development environment (IDE). 3. The document also demonstrates how to create and run a simple Java program in Eclipse that outputs "Hello Java!" to test that everything is installed correctly.

Uploaded by

lemuel sardual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views14 pages

Learning Activity Sheet Java (LAS) - 3

1. The document discusses the initial setup needed to begin Java programming, including downloading Java, the Java Development Kit (JDK), Eclipse, and testing a simple "Hello World" program. 2. It provides step-by-step instructions on downloading and installing Java from Oracle's website, downloading and installing the JDK from Oracle, and downloading and installing the Eclipse integrated development environment (IDE). 3. The document also demonstrates how to create and run a simple Java program in Eclipse that outputs "Hello Java!" to test that everything is installed correctly.

Uploaded by

lemuel sardual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

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
Chapter 2: The Initial Java Setup
(LESSON /OUTPUT TITLE)
LESSON OBJECTIVE:
1. Define Java ; and
2. Explore the potentials of JAVA programming
language.
Values integration:

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.

EXPLORE AND EXPLAIN:

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

The Initial Java Setup


Before you sit in front your computer and start coding, you need to make sure that you and
your machine are equipped for writing Java codes. It is strongly advised that you check out the
following websites and follow the instructions in downloading the required software that is usually for
free:
For Java software download and installation follow the following steps:
1. Goto the website http://java.com by typing this in the address bar of your web
browser. It will take you to the screen below:

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.

www.oracle.com/technetwork/java/javase/downloads - Download and install the required


Java SE documentation (also known as the Javadoc pages or Java SE API Docs)
Next:
1. Goto the website www.oracle.com/technetwork/java/javase/downloads , It will
take you to 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

2. Click on this option

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.

http://eclipse.org/downloads- Download and install theEclipse program you need

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

Create a new class named Displayer within the Java project.

Modify the new Displayer.java file by entering the following lines of code in the Editor
pane.

public class Displayer { public static


void main(String args[]) {
System.out.println(“Hello Java!”);
}
}

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

In the field of computer programming, software developers require existing programs to


create new programs. For example, you want to develop a Java program that will handle your
company’s employee records. In order to accomplish this, you might use an existing
program as an error-checking tool for your Java codes.

Required Java Tools

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 is part of a Java program


// (not a complete Java program).
rentalcarNum = 1;
while (rentalcarNum < 100) {
if (client[rentalcarNum] == 0) {
out.println(“Car ” + rentalcarNum
+ ” is available.”);
exit(0);
} else {
rentalcarNum ++;
}
}
out.println(“All cars or vehicles are rented out”);

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

Extend and Elaborate

1. What is the use of JDK?


____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

2. What is Compiler?

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

3. What is Interpreter?

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

EVALUATE:

CHECK YOUR UNDERSTANDING

What do you understand about Java IDEs?


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)

You might also like