Want to master OOP Java concepts easily? In this video, you will learn class and objects in Java with simple real-world examples perfect for beginners. This tutorial is designed for students and developers who want to understand java oop from scratch in an easy and practical way.
π Topics Covered:
βοΈ Introduction to oop java
βοΈ What is a class in Java
βοΈ What are objects in Java
βοΈ Class and objects in Java explained with examples
βοΈ Real-time coding demonstration
βοΈ Beginner-friendly java oop concepts
βοΈ Tips for java oop projects for beginners
βοΈ Part of our oop in java full course series
then this video is perfect for you! π―
π» Start learning Java programming step by step and improve your coding skills with practical examples.
π Donβt forget to LIKE π COMMENT π¬ and SUBSCRIBE π for more Java tutorials, Spring Boot tutorials, and programming content.
#Java #OOPJava #JavaOOP #ClassAndObjectsInJava #JavaTutorial #Programming #JavaForBeginners #javacourse
Show More Show Less View Video Transcript
0:01
Hi friends, welcome to tutors funny
0:03
channel. Today I'm bring the video of WP
0:07
with you. So I'm going to explain the
0:10
double OP it is a very must for
0:14
programming. Those who are interesting
0:15
in programming WP is very must. Okay. If
0:18
you are not understand WP you you cannot
0:23
be a program. Okay. So you must study
0:26
WP.
0:28
So today's our first class we are
0:29
discuss about the develop in Java class
0:33
and object. Okay. What is class? It is
0:38
nothing but
0:41
just a blueprint. It is nothing. It is
0:44
just a blueprint. Okay. So it define
0:47
variable and methods. Okay. Variable is
0:50
nothing but a data. Method is nothing
0:52
but a function and action. Okay. If
0:56
you're having a data the data how to
0:59
hack hack what is the action the action
1:03
which represent as a method okay data
1:07
which represent as a variable okay you
1:10
have to understand clearly these are the
1:12
concept is very uh very crucial things
1:16
okay when you are become a programmer
1:17
very crucial things right okay so first
1:21
we have to look at the example of car
1:23
car can be container color, brand,
1:26
speed. Okay, these are the called as
1:30
data.
1:32
Okay, car which has attributes. What are
1:35
the attributes? We have car. We can call
1:38
we can tell them car which is a name.
1:40
Car has a color, it should have a color,
1:42
it should have a brand, it should have a
1:43
speed. It's called as a car attributes.
1:46
What is the behavior of the car? Car
1:48
which has a start. We can start the car
1:51
and we can drive the car. These are the
1:53
called as a method. Okay. So this is
1:56
this is a variable. This is a these are
2:00
called as a variables. This is called as
2:02
this is known as a method. This is known
2:05
as a variable. This is known as a
2:07
method. You have to understand the
2:09
clearly this concept. What's the
2:11
difference between variable and methods.
2:15
Okay.
2:17
Okay. So objects and objects really
2:20
instance create from the class. instance
2:23
create from the class. Okay. So BMW car,
2:27
Toyota car, the both objects are created
2:31
from the car class. These are the
2:33
objects from the car class. Very simple
2:35
example. Okay. So this class so you can
2:38
see so you can see uh the real life
2:43
example class mobile phone design object
2:47
the Samsung phone. Okay. Mobile phone
2:51
design meets a common. Okay. Samsung
2:54
one of the brand. Okay. If it is a Sony
2:57
another brand called as objects. Okay.
3:00
We have to create the instance. After
3:02
that we are using from here. Okay. So we
3:05
can create the objects.
3:09
Okay. So here objects are objects are
3:11
real instance creating from the class.
3:13
Instance objects. Okay. You have to
3:15
create instance creating from the class.
3:17
We can use it the objects. Okay. Java
3:20
class and object you can create a class
3:21
for student it is this is a this is the
3:25
student class so how is the inform
3:27
coming from so we can do the practical
3:30
so you can easily understand so I'm
3:33
going to go to get the
3:35
net beats
3:38
okay if you not installed the net bits
3:40
is go to that uh
3:45
go to the Google and type net pins
3:49
nets and install them uh latest version
3:54
I can you can get it get okay
4:00
now what I'm going to do is I'm going to
4:02
this is your class so I'm going to go to
4:07
create the new project so go to that
4:12
file new project
4:16
So here I'm going to create a uh class.
4:20
So I'm going to go to the select here
4:24
Java and Java application. Click next
4:29
here. If it is a main class you have to
4:30
keep as it is you have to create
4:34
uh student
4:38
but name I'm going to create a
4:41
class
4:42
and object
4:47
this is my project
4:50
click finish
4:55
here class and object. Okay. So this is
4:58
so I'm going to this one. I'm going to
5:00
delete them.
5:02
At the moment we don't need them. I
5:04
remove them.
5:08
Now this is a package. This package I'm
5:09
going to create a class which is a
5:11
student.
5:16
Okay. This is a student. We don't need
5:18
don't bother. Sorry. This is a packages.
5:20
You don't delete the packages. Okay.
5:23
It's keep as it is. Okay. This package
5:25
which is nothing but this a package.
5:26
inside this packet we having a class
5:29
which is a
5:31
uh student okay it's nothing but a fold
5:35
okay so first what I did here is student
5:38
has a property student name and age so
5:42
name we have when you write the name it
5:45
belongs to the data type it is a string
5:48
string name understand
5:53
after that we have a H age which is
5:57
belongs to the database which is a data
5:59
type which is a int
6:05
which is nothing but a variables
6:09
declarations.
6:11
Okay. It is in WP hooks concept we have
6:14
to call as this one is a attributes or
6:18
data we have to there are many we can
6:23
call them as many names okay we can call
6:27
many ways like okay okay so after that
6:31
second one is this is a data we have a
6:35
action so the data how going to act so
6:39
it's nothing but a method
6:42
Okay. So what you're going to do is we
6:44
have to create the method which is a
6:47
white display
6:56
open and close bracket here. What you
7:00
here write here is we have to write it
7:03
here simply
7:06
system
7:09
dot outprint.
7:19
Okay. So here this name I'm going to put
7:21
it over here. Same thing I just copy it
7:25
and paste below this age.
7:29
Okay. So,
7:31
here is a data.
7:34
This data we have to print inside this
7:37
method. Okay. We have to uh Okay. This
7:41
is the thing simply you can understand
7:42
that this is the method. This is the
7:45
data. This is the method. Okay. This is
7:48
class which is a blueprint. Okay. Inside
7:51
the class we having a variables and
7:55
method. It is a class and objects. Okay,
7:58
this is a class. Now I'm going to create
8:01
the object. So object I'm going to
8:04
create it as a what is a you can create
8:07
another class which is a we can call as
8:09
this one as a main.
8:14
Okay. The main class it consist of a
8:17
main method. Okay. This is class your
8:20
consist of main method. Main method mean
8:22
this is the main method you have writing
8:24
here. What is the main method? You can
8:26
write this one
8:38
public static
8:42
but it's not it's a code
8:46
we can write it here simply public
8:50
static
8:52
write
8:55
string
8:58
a rgs array. Okay, so this is the main
9:02
method. Okay, this this here we are
9:06
program is storing and running. Okay,
9:08
this a main method. So how to call this
9:11
student class? First we have to create
9:13
the name of this class. What is the
9:17
class? Student.
9:21
You have to create the object which is a
9:24
one of student name. I can create here
9:28
uh John. Oh some John.
9:33
This a student equal new
9:36
student.
9:39
Whatever name student. This is the
9:42
called as object. This class we have to
9:45
access by
9:48
the same name. You have to call the same
9:50
name of the class name over here. Create
9:52
the object whatever you like. I just
9:54
create as this is all the student class.
9:56
So we have grade one of the student for
9:58
this class. I'm going to write your
10:01
grade whatever you can see here we
10:04
having a this object we have to call
10:08
John press enter here this two data is
10:13
coming data mean which is nothing but a
10:17
this two data string and name we having
10:20
a consist of that two we already we have
10:22
to
10:24
uh create the object which is John John
10:29
You have to select this name equal
10:33
John equal so that uh we can create this
10:36
student one. This is good one 61 mean
10:40
student one. We get the student name
10:42
John.
10:44
Okay. So the student has which has a
10:48
another one age
10:52
which is nothing but it belongs to
10:53
integer data type 21. This is this
10:57
simple
10:58
just simple after that we are call the
11:01
method st
11:03
one dot we have a method called st
11:06
that's it
11:08
now let's save all run the application
11:11
check what how the output will be
11:16
here
11:18
John and 21 will be displayed okay what
11:23
how how it will works
11:26
We have a name and age. So here the
11:29
second class main class what I did is
11:32
first we have to create the object of
11:33
this class. This class we having a two
11:36
data student and age here for name and
11:39
age. It is John is going to decide here.
11:42
Age is going to decide here age. Okay.
11:45
Or when you call the display method what
11:46
happen is it's come to here
11:51
going here at here what happen is what
11:56
is the name you are g given here
12:01
what's the name you are given here it's
12:04
command equal into here this class after
12:08
that when you display it is name should
12:12
be assigned to John and it is A will be
12:15
assigned to what? 21. When you call this
12:19
method, it has been written. This simple
12:22
way it is written. Okay,
12:26
got my point. Okay, simple way. Okay, so
12:32
the output will be display like this. We
12:35
create a class student. It's a variable.
12:39
So it's variables of that methods. So
12:44
objects object mean create a class name
12:47
object name st new mean memory of the
12:51
object mean when you create the object
12:52
you have to using the new keyword if you
12:54
are using the new keyword the program
12:57
will be understand the user going to
13:00
create the method so sorry object okay
13:04
so when you create the object you have
13:05
to implement the key keyword which is a
13:08
new okay when you create the object you
13:11
keep remember you have to using uh
13:15
keyword which is a new. Okay. When you
13:18
create the object your key remember you
13:20
have to use the uh keyword name use this
13:23
keyword you have to create that. Okay.
13:26
Simple.
13:28
Okay.
13:29
So
13:31
now this how we have run the practical.
13:33
So we having another practical also
13:35
here. Here the second one. So this one
13:40
having a card. So I simply just copy
13:43
this. I have to put into here instead of
13:46
show I meant to use it and explain.
13:48
Okay. Why this is not working.
13:52
Okay.
13:54
I can't paste it right now. Some problem
13:58
arising. So here it's working. I can't
14:01
paste it at the moment here.
14:08
So no problem. I I'm explaining. So the
14:11
same way what what we run the
14:15
programming as student okay the same
14:17
example here instead of the name and uh
14:21
age we have write string brand car brand
14:24
and car speed this is belongs to car
14:27
brand as string which belongs to the
14:29
data which is a speed it having a meth
14:33
method is show me method having a method
14:36
it's going to show method which is a so
14:37
method we have print we have print out
14:40
brand as well as a speed. Okay. So when
14:43
you uh where we write the main method,
14:49
so we have inside the public static
14:51
inside here what I did first you have to
14:53
create the uh class name. Okay. First
14:56
you have to write which is the class
14:57
name class name. After that we have to
14:59
using a new keyword and create the
15:00
object C1 C1 class one. Okay. Car one.
15:04
So carb one dot brand mean is brand BMW
15:09
speed 200 speed. This car with speed
15:13
dash speed 200. So this car which is car
15:17
two which is brand Toyota it belongs to
15:19
the brand Toyota and it uh the speed
15:22
belongs to 150. After that C1 C2 we have
15:26
to show the car statuses. Okay. So we
15:28
have to clear it BMW and Toyota has been
15:32
a simple answer. Okay.
15:36
Okay. So these are the questions always
15:39
the interview definition here the class
15:41
blueprint used to create the object. So
15:43
these are the things you must know
15:46
because the when you go to the Java
15:48
interviews so this is frequently asked
15:51
the questions. So I am also the
15:54
uh when you when I interviewing the
15:56
students so I mostly asking this
15:58
questions. Okay. This question is very
16:00
important stuff.
16:02
When you are a student or programmer you
16:05
must consider about concern about this
16:07
thing. This is very important stuff uh
16:09
when you become a programmer. Okay. So
16:11
this very good example this is you must
16:14
remember about this one. Okay. If you
16:16
not understand this well you cannot be a
16:20
programmer. Thanks for watching.
#Jobs & Education

