HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

#4.1 Java Tutorial | Class and Object

315,044 views November 8, 2018 9:19

Watch on YouTube
ChannelTelusko

Description from the creator

Check out our courses:

Agentic AI Engineering with Python : go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)

Master Java Spring Development : go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)

For More Queries WhatsApp or Call on : +919008963671

website : telusko.com/

Udemy Courses:

Java Spring:- go.telusko.com/Udemyjavaspring
Java:- go.telusko.com/udemyteluskojava
Spring: go.telusko.com/udemyteluskospring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopython
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodocker

Instagram : instagram.com/navinreddyofficial/
Linkedin : in.linkedin.com/in/navinreddy20
WhatsApp : go.telusko.com/whatsapp
Discord : discord.gg/D8hWe9BqfF

In this lecture we are discussing:
1) What is class and object?
2) Understanding class and object with real world example?
3) What are things inside a class?
a) example with their syntax
4) what is difference between reference variable and object ?

#1
What is class ?
As for definition you can say that class is blueprint of logical entity or real world entity.

e.g with some terms:
An entity can be of two types:
Tangible Entity: Tangible Entities are those entities which exist in the real world physically.
Example: Person, car, etc.
Intangible Entity: Intangible Entities are those entities which exist only logically and have no physical existence.
Example: Bank Account, etc.

What is object?
Object are either real world entity or logical entity or we can say instance of class.

#2
Understanding class and object with real world entity.
e.g
Suppose a civil engineers get a project to create a multiple same building in a locality.
Step 1: for that first they create a blueprint of building.
step 2: using this blueprint they can create multiple buildings.
step 3: but might be colour and use of this building depend on the user.

blueprint of building --- class
real concrete building --- object
colour and design --- variable
use of building --- method

now we are get better look of class and object.

#3
What are things inside a class?
:- class has two things mainly
a) variables --- know something (from building example we got colour and design of building)
b) methods --- does something (from building example we got idea use of building depend on user)

:- now come to programming world example of variable and methods
Syntax for creating class
class class_name{
//instance variable
//method
}

e.g
class Calculator{
int num1; //num1 is instance variable
int num2; //num2 is instance variable
int result; //result is instance variable

public void add(int num1, int num2) // add is method
{
result=num1+num2;
System.out.println(result);
}

public void sub(int num1, int num2) //sub is method
{
result=num1-num2;
System.out.println(result);
}
}

Note:
i) In upcoming video we are talking about void and public, but here you can only understand what is methods and variable.
ii) instance variable is a variable which is declared inside the class but outside the method .
iii) their is local variable which are created inside the methods but we will talk about this in upcoming videos.

#4
Difference between reference variable and object creation?

class Main{
public static void main(String []args){
Calculator obj; //here obj is reference variable not a object
obj=new Calculator(); // now new Calculator() create object of Calculator types
//reference variable is a variable which is used to store the address of object and object created in heap
}
}

Instagram : instagram.com/navinreddyofficial/
Linkedin : in.linkedin.com/in/navinreddy20
Discord : discord.gg/aXPF5hV7

More Learning :

Java - bit.ly/3xleOA2
Python :- bit.ly/3H0DYHx
Django :- bit.ly/3awMaD8
Spring Boot :- bit.ly/3aucCgB
Spring Framework :- bit.ly/3GRfxwe

Servlet & JSP :- bit.ly/3mh5CGz
Hibernate Tutorial :- bit.ly/3NWAKah
Rest API | Web Service Tutorial :- bit.ly/38RJCiy

Git :- bit.ly/3NUHB3V
JavaScript :- bit.ly/3mkcFys
Kotlin :- bit.ly/3GR2DOG

About this tutorial

Telusko published this 9:19 video tutorial on November 8, 2018. It has been watched 315,044 times on YouTube.

Channel
Telusko
Duration
9:19
Published
November 8, 2018
Views
315,044
Likes
4,624

Tags

Share

This tutorial in other languages