#22 Class and Object Practical in Java

  Рет қаралды 214,754

Telusko

Telusko

Жыл бұрын

Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Udemy Courses:
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
Java For Programmers:- bit.ly/javaProgrammers
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we will learn:
- Class in Java
- Syntax of class in Java
- Creation of objects in Java
- Methods in Java
#1
Whatever we do in Java, we do it in a class.
A class is a user-defined blueprint or prototype from which objects are created.
- In a class, we have methods and variables.
- Class will be created in the same java file.
- We can create any number of classes in a program.
- Class does not occupy memory.
Syntax of a class:-
class classname
{
methods, variables
}
#2
- Every object has two things: properties and methods.
- When an object of a class is created, the class is said to be instantiated. All the instances share the attributes and the behavior of the class.
- Action will be done with the help of methods.
- We need to specify the access to methods. We will specify it as public if we want it to be called from anywhere else.
- If we want the method to return any value then we need to specify its return type like int for Integer type values.
- As Java is a statically typed language so you have to specify the return type in it.
Syntax of method:-
= access modifier return type method name()
public int add()
{
statement;
}
#3
- We need an object to call a method from a different class.
- Creating an object:-
classname reference variable= new classname();
- reference variable is used to tell that this variable is made to establish a reference between a class.
- new keyword is used to tell that we have to utilise the space for an object.
- We can call a method by using the reference variable of the object.
- We have to pass the values if we want some operations to be on them.
- We also have to accept values in a method as well if we pass some values. For this, we have to specify parameters in a method based on the type of passed values.
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 63
@user-benjaminJohn
@user-benjaminJohn 9 ай бұрын
Telusko, this video is brillant! NO ONE has been able to articulate this to me in such a clear way. I wish I had found this video YEARS ago. 🙏 Your channel is pure🔥!
@032-m.muthuanushya2
@032-m.muthuanushya2 8 ай бұрын
Hey vera level bro 🎉 i can understand concepts very well it's my third days of java coding journey ,i continuously watching your tutorial and i follow ur tutorial only🎉.thank you 🎉🎉
@fezaiozcan2227
@fezaiozcan2227 Жыл бұрын
absolutely best tutorials about Java! thanks:)
@prasantdas587
@prasantdas587 3 ай бұрын
You are an amazing instructor. It’s not just how to write the code but why to do it certain way.. brilliant..
@nareshgajula
@nareshgajula 8 ай бұрын
Good but difficult for the beginners to understand the depth of your explanation!
@user-uq5yx4wl4u
@user-uq5yx4wl4u 7 ай бұрын
Congratulation you made java so easy in this short concept of object and class in java💯
@akankshamishra1262
@akankshamishra1262 7 ай бұрын
Hi, Thanks a lot for excellent explanation, very understandable to beginners, I'm learning java for automation selenium with your video.💯
@91-ritikjain36
@91-ritikjain36 Жыл бұрын
sir you are the best teacher sir plzz create a new series on jsp and servlet
@mango-strawberry
@mango-strawberry Жыл бұрын
Literally perfect explanation
@Trunk_Tech
@Trunk_Tech Жыл бұрын
Am enjoying every bit of these lessons......Kudos
@user-wg6ud3hh1n
@user-wg6ud3hh1n 8 ай бұрын
it was an excellent explanation. Very understandable to beginners.
@chichhasquad2342
@chichhasquad2342 5 ай бұрын
Never been this much easy. Hatts off bro .
@aishwaryab673
@aishwaryab673 3 ай бұрын
Hey TELUSKO, this was my first comment on KZbin because I was such an introvert to even make a comment, The way you teach I admire a lot and this video is incredible and it paves me to think of exploring all your courses!!!! Thanks again Telusko !!
@rohithvarma6763
@rohithvarma6763 6 ай бұрын
probably the best java teacher in the world
@rahulmansarowar1430
@rahulmansarowar1430 5 күн бұрын
your all videos is excellent! i wish i had found this collection years ago.❤
@yitingchen8278
@yitingchen8278 Жыл бұрын
Good explanation!
@shaikmansoor223
@shaikmansoor223 6 ай бұрын
00:05 In this video, we learned about classes and objects in Java. 01:57 Design your objects by separating manufacturing and designing 03:49 Methods in Java must specify access and return type 05:39 Designing a class with a variable and a method 07:35 To create an object, you need to specify the type and use the 'new' keyword. 09:40 How to create an object in Java 11:47 Create a variable called R and assign the sum of num1 and num2 to it 13:42 The video discusses how to create a class in Java and use it to add two values.
@photolab6712
@photolab6712 7 ай бұрын
superb lecture...
@chinyamaraphael-sp6wt
@chinyamaraphael-sp6wt 2 ай бұрын
I don't know how I can express myself. We did objects with my lecturer but I did not understand what he was saying until I found this video. You are a redeemer. ❤
@bandarisailikhitha9865
@bandarisailikhitha9865 6 ай бұрын
Thanks navin, you are awesome
@Shubham-fk4is
@Shubham-fk4is Жыл бұрын
It was easy in Python, but unable to understand in Java.
@shandeshchaudhary-ps1tz
@shandeshchaudhary-ps1tz 6 ай бұрын
you are the best man
@chaitanyathorat8429
@chaitanyathorat8429 Жыл бұрын
Perfectooo👌👌
@shobhashobha2614
@shobhashobha2614 5 ай бұрын
Hi sir Which language is best for preparing dsa?
@agilan1546
@agilan1546 7 ай бұрын
Why are we creating a variable int a in the calculator class?
@RK_Universe
@RK_Universe 4 ай бұрын
can't find main(String[]) method in class-How to solve the issue.Pls comment sir.
@abishekathangaselvam6673
@abishekathangaselvam6673 7 ай бұрын
First time i am disappointed with ur series,actually u r confusing and still now not told about getting inputs very disappointed sie
@pydisettymahesh9655
@pydisettymahesh9655 7 ай бұрын
it is an exaple of inheritance
@nprince411
@nprince411 5 ай бұрын
tqs sir
@hrishikeshmukherjee813
@hrishikeshmukherjee813 Жыл бұрын
Super
@rsvcreations7450
@rsvcreations7450 17 күн бұрын
sir when i am trying this i am getting error that "can't find main method in calculator class"
@pinkeykumari1312
@pinkeykumari1312 5 ай бұрын
my java file created but class not loaded then what to do?
@darshilchitranshi592
@darshilchitranshi592 6 ай бұрын
14:21 summmary
@gugulothusaritha1221
@gugulothusaritha1221 Жыл бұрын
sir,Increase the font size
@nandasiddiksha5534
@nandasiddiksha5534 Жыл бұрын
how to get user input?? Instead of assigning values to variables..
@__sam_danielW
@__sam_danielW Жыл бұрын
We have to import scanner so that we can get the input from the user
@ourera2279
@ourera2279 3 ай бұрын
does anyone know where are the pratice questions for these ?
@tekkishort9018
@tekkishort9018 6 ай бұрын
U need to redo this part all parts were clear and concise until this video it's very bad redo it
@kanushagrawal7192
@kanushagrawal7192 2 ай бұрын
why are we using diffrent classes for adding where it can be done easily in one class only??? why to complicate things??? and also did not understand anything rest all the videos were superb but i dont know why
@_Deepak__Verma
@_Deepak__Verma 9 күн бұрын
Instead of creating classes can't we make a complex function that works exactly the same way then why use class
@timsy4401
@timsy4401 10 ай бұрын
this video is not much clear
@sonaligaikwad-zo5ds
@sonaligaikwad-zo5ds Ай бұрын
But in calculator class main method is not declare
@arashgh7461
@arashgh7461 Жыл бұрын
Thanks for that. i have a project in java will you help me on that payable
@The_Shrock69
@The_Shrock69 8 ай бұрын
Bro😂
@RamgiriRachaRayudu
@RamgiriRachaRayudu 3 ай бұрын
🥳
@AnuragRawat01
@AnuragRawat01 11 ай бұрын
Thank u so much 💯❤️
@rohitn6063
@rohitn6063 3 ай бұрын
14:37
@manojm1853
@manojm1853 4 ай бұрын
2:57 my iPhone says the same
@kirubasathish3683
@kirubasathish3683 Жыл бұрын
sir we can add the number like this also sir? class Calculator{ int a; public int add() { System.out.println("add"); return 12 + 12; } } public class java1 { public static void main(String a[]) { Calculator calc = new Calculator(); int result = calc.add(); //int result = num1 + num2; System.out.println(result); } } and good explanation sir
@kartheekk2380
@kartheekk2380 Жыл бұрын
can you please explain 2nd line why we have to mention int a; please
@hellohell143
@hellohell143 Жыл бұрын
​​​​@@kartheekk2380bro we are not using a he just shows how to declaration a data type in class
@malvikaambastasquestx5965
@malvikaambastasquestx5965 10 ай бұрын
Yes, this will work.
@malvikaambastasquestx5965
@malvikaambastasquestx5965 10 ай бұрын
@@kartheekk2380We don’t need to put it. Not compulsory.
@sheiduwgwjd
@sheiduwgwjd 3 ай бұрын
Confusing
@divakarpareek9466
@divakarpareek9466 9 ай бұрын
@telusko -- I must say your previous Java series of 6 hrs was much better then this one. I have come to 22nd video, in almost each video you are struggling to put clear example and changing in between that's frustating . It should be pre prepared.
@abdulbasith3818
@abdulbasith3818 9 ай бұрын
Can you pls mention that vedio
@abdulbasith3818
@abdulbasith3818 9 ай бұрын
For me it is little bit tuff
@rutulkarbhari4963
@rutulkarbhari4963 11 ай бұрын
not working for me even if I have the same codes as you. Giving - error: can't find the main(String[]) method in class: Calculator. Solution?
@naveenrajanaveen6462
@naveenrajanaveen6462 10 ай бұрын
Put (String args[]) instead of (String []) You want to give a name like args, abc, etc..
@rutulkarbhari4963
@rutulkarbhari4963 10 ай бұрын
@@naveenrajanaveen6462 was helpful. And i also wanted to thank you sir🙏.
@miethrayan
@miethrayan 10 ай бұрын
​@@naveenrajanaveen6462 but it shows error in main method
@alex__coder
@alex__coder 10 ай бұрын
define calculator class after the hello class, then it will work fine@@miethrayan
@rockybalboa6969
@rockybalboa6969 8 ай бұрын
14:21 summmary
#23 JDK JRE JVM in Java
5:22
Telusko
Рет қаралды 223 М.
#21 Class And Object Theory in Java
5:48
Telusko
Рет қаралды 211 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 5 МЛН
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 30 МЛН
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 306 М.
#24 Methods in Java
11:30
Telusko
Рет қаралды 197 М.
#26 Stack And Heap in Java
12:37
Telusko
Рет қаралды 221 М.
#40 Encapsulation in Java
11:42
Telusko
Рет қаралды 156 М.
#61 Abstract Keyword in Java
12:09
Telusko
Рет қаралды 135 М.
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1 МЛН
Java Method References - A Beginner's Guide
12:59
Dan Vega
Рет қаралды 3,9 М.
#60 Wrapper Class in Java
8:08
Telusko
Рет қаралды 163 М.
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 8 МЛН
My iPhone 15 pro max 😱🫣😂
0:21
Nadir Show
Рет қаралды 1,7 МЛН
Это - iPhone 16!
16:29
Rozetked
Рет қаралды 399 М.
8 Товаров с Алиэкспресс, о которых ты мог и не знать!
49:47
РасПаковка ДваПаковка
Рет қаралды 178 М.
КРАХ WINDOWS 19 ИЮЛЯ 2024 | ОБЪЯСНЯЕМ
10:04