Demo LP

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

RIZAL TECHNOLOGICAL UNIVERSITY College of Education, BTVTED Department

Boni Avenue, Mandaluyong City

LESSON PLAN
Date/Time: May 5 2023: Friday/ 8:00-9:00 AM
Duration
1. OBJECTIVES
At the end of the lesson, the students are expected to:
1 Explain Java Classes and Objects.
.
1
1 Identify the types of variables and Objects
.
2
1 Create a simple program about Java Classes and Objects.
.
3
2. CONTENT
2.1. Topic
2.1.1.
● What are Java Classes and Objects?
Subtopic
● The Different Types of Variables and Constructors.

2.2 Materials PowerPoint, Laptop/Computer/Mobile Phone/Projector


2.3
● https://www.simplilearn.com/tutorials/java-tutorial/java-classes-and-
Reference/s
objects#the_concept_of_java_classes_and_objects.

● https://www.w3schools.com/java/java_classes.asp

● https://www.geeksforgeeks.org/classes-objects-java/

3. PROCEDURES
3.1. Preparatory Activity
3.1.1. Classroom Management 2 min.
3.1.2. Prayer/Greetings 2 mins.
3.1.3. Checking of Attendance 5 mins.
3.1.4. Review
● Recap of the topic last week
What is Java Recursion?

3.2. Developmental Activity


3.2.1. Motivation 10 mins.
Title: “Balloon Pop”
Mechanics:
Instructions:
1. Click the link given.
2. Click start and read the questions being asked posted on the screen.
3. Pop the balloons to drop each keyword unto uts matching definitions.
Material/s:
Mobile phone/ Computer/
Laptop Slides presentation

3.2.2. Lesson Proper 45 mins.


Teacher’s Activity Student’s Activity

Okay class, do you find our activity *students raising their hands*
engaging? Yes, Ma’am it’s fun and exciting!

That’s good to hear. Now, Could you share


your thoughts about what we did earlier? *students raising their hands*
Ma’am it’s about defining some properties and
behaviors.
Great, another one who wants to share
their thoughts about our activity?
*students raising their hands*
Ma’am I feel confused because of the time. I feel
tense at the same time I find our activity enjoyable.

Very Good! Now let’s move on to our topic


today about Java Classes and Objects. Is
there anyone who is familiar with this?
*calls students* *students raising their hands*
Ma’am Java Classes and Objectives used to
create a program.

Good! Any other ideas?


*calls students*
*students raising their hands*
Ma’am Java is associated with classes and objects,
along with its attributes and methods.

Now let's see if your ideas and thoughts are


right. Our topic today is about Java Classes
and Objects. Since Classes and Objects have
a different function we are going to tackle
first Java Classes. Do you have any idea
what Java Classes are?
*calls students*
*students raising their hands*
Ma’am Java Classes allows you to create modular
programs and reusable code.
Great! Any other ideas?
*calls students *students raising their hands*
Ma’am Java Classes are important when we
create a program because it is a data type that
defines a template.

Very Good. In other words a class refers to


the category or type of objects.
For example your cat Kitty is of type cat,
your red Mercedes is of type car and your
bank account is of type savings account. A
class has variables defining properties and
methods defining behavior of its objects.

Do you have question clarification in this


topic?
*calls students*

*student raising their hands*


None so far Ma’am

Great! Since you don’t have a question or


clarifications Let’s move on to our next
topic which is the Variables. Does anyone
here know what a variable is?
*Calls Students *

*students raising their hands*


Ma’am a variable is something that deals with the
information associated with the class and objects.
Good Job! In addition, a variable is named a
field containing information Associated
with the class or object.
For example the color variable of Class Cat
indicates the color of the specific cat. A
variable has a data type indicating what
type of variable (number, text, array,
custom, etc).

Is there any question regarding this


example?
*calls students*

*students raising their hands*


Ma’am None so far
Good Job! Since you don’t have any
questions Let’s now begin with the types of
Variables there are different types of
variables. We have the local, Instance and
Class. Does anyone here know the
difference between those variables?

*students raising their hands*


Ma’am Local variable is declared inside the class
method while the instance declared inside and the
Good! Any one who wants to share their class variable is used to declare common variables.
thoughts?
*calls students*

*students raising their hands*


Ma’am None
That’s correct! In addition, local variables
declared inside a class method constructor
while the Instance variable declared inside
a class but outside of any method or
constructor and the class Variables declared
inside a class with the keyword static.
Do you have questions about the types of
Variables?
*calls student*

Great question! The answer is No because it


is specific and is not shared among other *students raising their hands*
instances. Ma’am Can we use Instance Variables just like the
Any other questions? other instance?
*calls students*

*student raising their hands*


Good! Now let’s proceed to the next topic Ma’am None so far
which is Methods of Java Classes
Does anyone here have an idea of what the
methods are?
*Calls students*

*student raising their hands*


Ma’am we don’t have an idea of the method
that we know was our topic last time which is
different to our topic now.
Okay Thank you! In java classes the
methods are used to describe behavior of
the objects of a class and a set of
statements which is referred to by name
and can be invoked at point in a program.
For example, the get_mileage() method in
class Car is used to return a specific car’s
mileage. In our cat example, meow() and
drink _milk are methods of the cat objects,

Is there any question or clarification


regarding this example?
*calls students*

Great! Since you don’t have questions or *student raising their hands*
qualification let’s proceed to the Syntax Ma’am None so far
Method
In conclusion Public int it is used to return
type indicates the data type of the variable
returned by a method. While the public
void is the name of a method and the body
of the method describes the functionality. If
you remember the topic that I discussed
before it is the same but different
functionalities.
Is there any question or clarification here?
*calls students*

Great! Now let’s move on to the


Constructors. Any idea of what a
*student raising their hands*
Constructor is in Java Classes? Anyone Ma’am None so far
*calls students*

Good! Another one who wants to share


their ideas?
*calls students* *students raising their hands*
Ma’am is similar in instance variables.

Good! In addition, a constructor is a block *students raising their hands*


of code defined in a class that initializes the Ma’am is automatically called when the instance
newly created object. Before we move in to is created.
the example let’s define and relate
constructors in a different scenario
constructors is like a person that builds and
design let say engineers and artist that
create different structure and paintings.
Now going to our topic Here is the example
below of creating a constructor;

*students raising their hands


Ma’am i want to try
*students will answer*
Okay Ma’am

Is there anyone here who wants to try ? *Students raising their hands*
Yes Ma'am first identify which are the objects and
*calls students*
types and then i started to code and then follow the
flow of the example.
Great! You can share your screen while
doing the example. I will give you 3 minutes
to finish the program.

*students raising their hands*


Ma’am None so far
Are you Done ? If you are done pls explain
to your classmates how you do it.
*calls students*

Good Job! In conclusion, creating a Java


Class Object you must identify first the
types.
Is there any question?
*student raising their hands*
*calls students*
Ma’am one of the types of constructors with no
argument constructors is one who takes no
arguments parameters.

Great! Now let’s move on to the Types of


Constructors. There are 3 types of
Constructors. Does anyone here know the
types of constructors? Can you give me at
least one type of constructor?
*calls students*
Great! That’s one of the types of
constructors: the No Argument that takes
no arguments parameters and the Default
constructors if a class does not have any
constructor java compiler insert a default
constructor into the code. While the
Parameterized constructors a constructor
with arguments or parameters is known.
Here are the example below *students raising their hands*
Ma’am None so far

Is there any question here?


*calls students*

Good! Since you don’t have a question let’s


proceed to the Class Syntax – Revisited
Below is the example of Class Syntax
Revisited.

In conclusion the public class class is the


name of the class and it is also known as
the variables and the system.out.print that
says the sound of a cat is the constructors
and the public void is the methods.
Are there any questions here?
*calls students*
*students raising their hands*
Ma’am None so far
Great! Now let’s Differentiate the use of
objects and functions below.
What do you observe in this picture?
*calls student
*students raising their hands*
Ma’am the class is the blueprint of the car while
the object is the instance of the class.

Good! In conclusion the class is like a


template and the object is the model.
Are there any questions or clarifications?
*calls students* *students raising their hands*
Ma’am None so far

Great! Since you don’t have questions that


would be all Thank you and Godbless.
Application 15 mins.
INSTRUCTIONS:
1. Bring out your Phone and go to the JAVA-NIDE application.
2. You are not allowed to open other applications except JAVA-NIDE.
3. Create a “myObj” object and assign any value to an “x” variable.
4. Print the value of x variable.

public class Main {


int x = 10;

public static void main(String[] args) {


Main myObj = new Main();
System.out.println(myObj.x);
}
}

OUTPUT
10

3.2.4. Generalization 5 mins.


1. Give the definition of Java Class and Objects.
2. Differentiate the use of Java Class and Objects.
3.2.5. Valuing 5 mins.
● What is the importance of programming in mathematics in real life?

● State the importance of Java Classes and Objects in programming?

3.2.6 Evaluation 10 mins.


Direction: Identify what is being asked by the statements below:

Identification:
1.It is a template used to create objects and to define object data types and methods?
2.It is named as a field containing information Associated with the class or object?
3-5.In any order, give the three types of constructors.
6. A constructor with arguments or parameters is known as ?
7. A variable that is declared inside a class but outside in any method or constructor?
8. It is used to describe the behavior of the class.
9-10. In any order give at least 2 types of Variables.

Answer Key:
1. Java Class
2. Variables
3. No Argument Constructors
4. Parameterized constructors
5. Default Constructor
6. Parameterized Constructor
7. Instance Variable
8. Methods
9. Local Variable
10. Instance Variable
4. ASSIGNMENT 4 mins.
INSTRUCTIONS:
1. For your asynchronous activity.
2. Fill in the missing parts of syntax below.
3. Write your answer on a yellow pad of paper.
4. Try it on Java Eclipse , or Java N-IDE, or an Online compiler.
5. Screen record your output, and upload the recordings to this link.

// Create a MyClass class


public class 1.________ {
int 2._____ ; // Create a class attribute x

// Create a class constructor for the MyClass class


Public 3.________ () {
x = 4.___ ; // Set the initial value for the class attribute x to 5
}

public static void main(String[] args) {


// Create an myObj object of class MyClass (This will call the constructor)
MyClass 5.________ = new MyClass();
// Print the value of x
System.out.println(6. ______. 7.____);
}
}

Answer Key:

1. Myclass
2. x
3. Myclass
4. 5
5. my0bj
6. myObj
7. x

Prepared by: Mary Grace Opiz Approved by: Mariacil A. Agustin

You might also like