0% found this document useful (0 votes)
44 views

Programming 3 - Module 2

The document is a student learning module on Java programming from Cieverose College. It covers lesson 2 on understanding comments, variables, and data types. The lesson explains the different types of comments in Java like single-line and multi-line comments. It also discusses variables as containers for data and the basic data types like integer, double, boolean, char etc. The lesson concludes with activities for students to test their understanding.

Uploaded by

helios3279
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Programming 3 - Module 2

The document is a student learning module on Java programming from Cieverose College. It covers lesson 2 on understanding comments, variables, and data types. The lesson explains the different types of comments in Java like single-line and multi-line comments. It also discusses variables as containers for data and the basic data types like integer, double, boolean, char etc. The lesson concludes with activities for students to test their understanding.

Uploaded by

helios3279
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CIEVEROSE COLLEGE, INC.

1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

CIEVEROSE COLLEGE, INC.


1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

Programming 3

Java

STUDENT
LEARNING
MODULE

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |1
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

Programming 3
LESSON 2
(Week 2)
Understanding Comments, Variables, and Data Types
2.1 Understanding Comments
2.2 Learning Variable
2.3 Data types and its function
2.4 Running simple program with data type, variable, and comment

To start with this module, you are advised to follow these simple instructions to
assure learning.
1. Look for a good place to study to. It should have clear surroundings, proper ventilation,
free from different noise, and make sure the lights are on.
2. Prepare all the learning tools and materials.
3. Answer the pre-test based on your retained learning.
4. Read and analyze the content of the module.
5. Takedown notes so that you will remember all the important details.
6. Finish all the activities in the module. Enjoy every moment of doing it.
7. Let the facilitator/guardian evaluate your work.
8. Review and prepare for the post-test.
9. Apply the skills you have learned after doing all the activities.

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |2
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

For this lesson, you are expected to:


* Importance of comments.
* Understanding the variable.
* Learning different types of data type.
* Applying comments, variable, and data type.

JUMBLED LETTERS
Directions: Read each statement and rearrange the jumbled letters to form a word
that is being described in the statement. Write your answers on the line provided.

1: Annotation used to explain C++ code however it doesn't effect on the behavior of the code.
mctenom = _________________________________

2. Considered a temporary containers or a place holder.


rlivbaae = _______________

3. Stores whole number, without decimal.


negtier = ________________

4. Stores true or false values.


oeoanbl = _________

5. Stores single character.


rhca = _________________

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |3
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

Lessons

Lesson 2: Understanding Comments, Variables, and Data types


2.1: Comments
- Comments can be used to explain java code, and to make it more readable. It doesn't effect
on the behavior of the program.
- The programmer can use them to include short explanations or observations within the source
code itself. In this case, the line is a brief description of what our program is.

// - (line comment) All lines beginning with two slash signs (//) are considered comment and
any text between // and the end of the line is ignored by the compiler (will not be executed).

/* */ - (block comment) Discards everything between the /* characters and the first appearance
of the */ characters, with the possibility of including more than one line.

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |4
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

2.2: What is variable?


- Variables are "containers" for storing information or a place holder.

- To create a variable, you must specify the data type and assign it a value:

Very important: The java language is a "case sensitive" language. That means that an
identifier written in capital letters is not equivalent to another one with the same name but
written in small letters. Thus, for example, the RESULT variable is not the same as the result
variable or the Result variable. These are three different variable identifiers.

2.3: Data types

Basic Data Types

The data type specifies the size and type of information the variable will store:

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |5
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

Example:

OUTPUT:

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |6
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

2.4: Let us try this to your Desktop/laptop or cellphone.

OUTPUT:

2.7: Same result but Different approach.

OUTPUT:

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |7
CIEVEROSE COLLEGE, INC.
1644 ILANG-ILANG ST., CAMARIN CALOOCAN CITY

Post test

Activity#1:
- Create a program that you will use “comment” describing what data type you are
using and use “double” for adding two variables with a value of 5 and 5.5 and the
result should be like this below.

OUTPUT:

Activity#2:
- Write the correct answer.
1. What is the code for the single line comment?
2. What is the code for the multiline comment?
3. What data type stores true or false values?
4. What data type stores a single character/letter/number or ASCII values?
5. What data type stores whole number without decimals?

CIEVEROSE COLLEGE, INC.


Ilang-ilang St. Camarin Programming 3 - Java Jefferson Guevarra
Caloocan City Lesson 2 - Week 2 Teacher
Page |8

You might also like