Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

#1 class and object in java | Java for Beginners

Автор: SG Tutorial

Загружено: 2021-08-09

Просмотров: 9726

Описание:

#1 Java for Beginners | class and object

About this video:
This tutorial will explain concept of class and object with real life Point of view and with programming point of view too..

Links:
To learn about basics of Java click here 👇
   • Java Tutorials for Beginners | Java course...  


OOP Concepts Playlist:
   • Java OOPs Tutorials for beginners in simpl...  

Java Multithreading Tutorials for Beginners in simplified way:    • Java Multithreading Tutorials for Beginner...  



NOTES :
1.What is a class?
2.What is an object?
3.How to create a class?
4.How to create an object?
1.What is a class?
Class is a prototype from which objects can be created.
Class can also be defined as 
The collection of objects because,you can create multiple objects using single class.
2.What is an object?
Object is instance of a class..
This means, object is a result that we get from a class..
And each object has it's fields /characteristics and actions / functions
For example,
Mobile Phone,
Mobile Phone is also an object..
And each mobile phone has
It's fields like,
colour, height, screenSize.
And actions like,
calling,ringing,sendData, receivedData etc.Remember one thing about class and object..
When we execute/ run the program then first program will load into memory and then execute
That means, first program will occupy some space into memory and then execute
Similarly,
In java,
During the execution of program,
first program load into memory this means will occupy some space into memory and then execute but class won't occupies any space into memory during the execution of program because
Class is logical entity.
So Class is work as file in that we have to put our logic
hence class will just be saved as a file on hard drive.
But object occupies memory during the execution of program because object is physical entity because
each object has it's actions.
This means each object can perform certain task.
Such as, Mobile Phones
Mobile Phone is also one of an object and it also has it's actions like,
Calling,ringing,send data, received data etc.
So basically,
In java, object is considered as a physical entity and class is considered as a logical entity.
3.How to create a class?
To create a class you can use following Syntax
AccessModifier ClassKeyword ClassName
{
// Class Members;
}
Access-modifier:
access - modifier controls the access level/ scope of a class.
In java, there are four type of access modifier.It's public,private,protected,and default but you can use only two access modifier for a class.It's public and default
If you declared class with
modifier public then class is accessible or visible to all classes in a program and if a class has no modifier then it's considered as a default and it is visible only within its own package and won't visible to other packages.
NOTE:Package is a group of related classes.
class-keyword:
Class keyword is used to create a class.
Class keyword is predefined keyword / reserved keyword.
Class keyword should be in lower-case otherwise compiler will raise an error because, Java is
a case-sensitive language.
Class-Name:
Class name should always start with upper case letter.
Class-Body:
Class body surrounded by curly braces.
Class body contain class members and class members are fields and actions so fields are called as Variables and actions are called as Methods.
For example:
public class Test
{
//declaring variables
int var1;
int var2;
//declaring methods
public void display (){}
}
In this example,
public is access modifier and Test is class name.
var1 and var2 are variables (fields) and display() is method (actions)
4.How to create an object?
To create an object you can use following syntax
Syntax:
Class_Name object_name = new_keyword Class_Name();
new-keyword:
"new" keyword is used to create an object
It is a predefined keyword that java provide us to create an object and
during the creation of an object compiler immediately allocate memory to an object and hence "new" keyword is also used to allocate memory to an object..
"new" keyword followed by class name and parantheses it represents the constructor of the class.
Constructor is a special method that has same name as that of a class.
Constructor is used to give initial value to an object.
That means when object creation take place then compiler immediately allocate memory to an object and give initial value(default values) to an object.
NOTE:Default values might be 0 or null.
For example:
You can create an object as follows,
Test obj = new Test();
here,
Test is class name,obj is object name and Test() is constructor.
_________End___________

Thank you for watching 🙏

#javaclassandobject #classandobjectinjava #sgtutorial #javatutorial #javatutorialforbegginers #java #classinjava #objectinjava #class #object

#1 class and object in java | Java for Beginners

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

#3 Variable in Java| Java Tutorial | What is Variable in Java | Java Variable

#3 Variable in Java| Java Tutorial | What is Variable in Java | Java Variable

Синьор 1С: 10 привычек, без которых ты не вырастешь

Синьор 1С: 10 привычек, без которых ты не вырастешь

#2 Method in Java | Java for Beginners | Java Method

#2 Method in Java | Java for Beginners | Java Method

JavaScript - Полный Курс JavaScript Для Начинающих [11 ЧАСОВ]

JavaScript - Полный Курс JavaScript Для Начинающих [11 ЧАСОВ]

Java OOPs Tutorials for beginners in simplified way

Java OOPs Tutorials for beginners in simplified way

Thread Life Cycle in Java  |  Java for Beginners

Thread Life Cycle in Java | Java for Beginners

Learn JAVA : Class and Object in JAVA  [#1 Java Tutorial]

Learn JAVA : Class and Object in JAVA [#1 Java Tutorial]

join() Method in Java Multithreading | Importance of join() method in Java | Java for beginners

join() Method in Java Multithreading | Importance of join() method in Java | Java for beginners

Java Tutorials||  OOPS Features: Class Vs Object || by Nagoor Babu

Java Tutorials|| OOPS Features: Class Vs Object || by Nagoor Babu

JavaScript c Нуля - Курс для начинающих С ПРАКТИКОЙ (2025)

JavaScript c Нуля - Курс для начинающих С ПРАКТИКОЙ (2025)

Java Streams Part 1 - Introduction

Java Streams Part 1 - Introduction

The Windows 11 Disaster That's Killing Microsoft

The Windows 11 Disaster That's Killing Microsoft

Java Abstraction | Java tutorials for beginners

Java Abstraction | Java tutorials for beginners

Method Overriding in Java | Java Method Overriding | Java for Beginners

Method Overriding in Java | Java Method Overriding | Java for Beginners

Static Keyword in Java | Java for beginners

Static Keyword in Java | Java for beginners

Windows Is Dying..

Windows Is Dying..

#5 Java Constructor | Java Tutorial for Beginners

#5 Java Constructor | Java Tutorial for Beginners

Изучите Java за 14 минут (серьезно)

Изучите Java за 14 минут (серьезно)

Methods in Java

Methods in Java

Explain about public static void main(String[] args); ( PART- I )

Explain about public static void main(String[] args); ( PART- I )

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com