Java Tutorial For Beginners 18 - Classes and Objects in Java

  Рет қаралды 597,012

ProgrammingKnowledge

ProgrammingKnowledge

Күн бұрын

Пікірлер: 205
@scater1230000
@scater1230000 8 жыл бұрын
Before you understand code you will hate it, once you understand it, you will enjoy speaking it.
@FaithBiete
@FaithBiete 7 жыл бұрын
I am stuck with class in Java. I know that basic but this getin function is complicated
@glowmate3809
@glowmate3809 7 жыл бұрын
Steve, honestly FUCK YOURSELF
@vita213.
@vita213. 6 жыл бұрын
Spot on Steve
@user-lp5us4id2d
@user-lp5us4id2d 6 жыл бұрын
Ya u r true! Coding is so addictive once you understand it
@confidoplaysfx
@confidoplaysfx 5 жыл бұрын
Faith Biete man ty for this quote ,it’s hard for me to put effort into this java class but this will definitely help🙌🏾
@stevenkasuba6207
@stevenkasuba6207 5 жыл бұрын
just learnt something i never understood all through out my programming life in the university .thank you
@swatkowski09
@swatkowski09 5 жыл бұрын
Make sure you change the batteries on your smoke detectors.
@vananhle-bacquelot4832
@vananhle-bacquelot4832 4 жыл бұрын
I am curious to know what this quote really mean? Sorry if it might be a silly question.
@vananhle-bacquelot4832
@vananhle-bacquelot4832 4 жыл бұрын
I am curious to know what this quote really mean? Sorry if it might be a silly question.
@Gamerboy-gl7di
@Gamerboy-gl7di 4 жыл бұрын
@@vananhle-bacquelot4832 ok no problem
@NoorAlam-xe8it
@NoorAlam-xe8it 4 жыл бұрын
Actually I think he smokes while shooting video
@jacquelinecahill1827
@jacquelinecahill1827 8 жыл бұрын
I watched some of your C++ videos (until I found out I was in the wrong class) and this is the first time using this for java. You do a great job making it simple for beginners. Thanks a ton...you have been a great help for me.
@Metalist2150
@Metalist2150 5 жыл бұрын
Thank you for this. Only halfway through the video, and already drawn more knowledge from it than the hour(s) I spent trying to learn objects on docs. Great explanation of why you use getters & setters, encapsulation and whatnot. Thank you, this is gold
@shaifnachiya4729
@shaifnachiya4729 9 жыл бұрын
You are super duper awesome. You really made me to understand and how to build from the basic. Each and every videos are filled with golden keys. Thank You
@abdel5244
@abdel5244 8 жыл бұрын
i clicked on an Ad , hope that could benefit you in some way ;) Thanks for the tutorial.
@robertreimann1846
@robertreimann1846 8 жыл бұрын
Good job :D
@nethmal1204
@nethmal1204 4 жыл бұрын
very good :)
@happyfishjj
@happyfishjj 7 жыл бұрын
After all these years, I finally understood why do we need to use the keyword this. Thank you very much!
@umerfs7366
@umerfs7366 8 жыл бұрын
The whole reason to generate those getters and setters was to make your instance variables private, and you didn't do just that. private int id; private String name; private int age; is the way to go. (In your Student class.)
@maXImuS9683
@maXImuS9683 8 жыл бұрын
constructive criticism. important information. thanks.
@britninja5969
@britninja5969 5 жыл бұрын
I don't know if you still on YT, but could you elaborate on your suggestion? Should I instead of Getting and Setting just put the private infront of the datatypes or how would it work, bc if I just "add" private infront of id and String it tells me that Student.name etc. is not visible....
@justsmell3
@justsmell3 5 жыл бұрын
@@britninja5969 No he is saying the point of adding the getters and setters is so your variables can be private. So make your variables private AND use the getters and setters. This way, the variable can only be accessed the way you intend them to be.
@johnsnowkumar359
@johnsnowkumar359 4 жыл бұрын
@@maXImuS9683 Author of article probably didn't want to confuse non - hard core programmers. He wanted to avoid confusing people by bringing in more concepts such as private at this stage.Umer is obviously a more knowledgeable or even probably a hard core programmer.
@gabrielalbino862
@gabrielalbino862 5 жыл бұрын
Very clear explanations. You've clarified my doubts about objects and classes in java, and in particuler the use of getters and setters to encapsulate data. Thank you, Sir. May God bless you in this endeavor!
@kotshifotshi739
@kotshifotshi739 4 жыл бұрын
Really helpful and clear, you make everything very simple Thanks aloooot
@7842347185
@7842347185 9 жыл бұрын
Awesome explanation Bro...I have seen many videos on getter and setters but i never understand how it works. But this video was lifesaver. Thank you so much bro.
@Just1MorePerson1
@Just1MorePerson1 8 жыл бұрын
I love you man you make this so easy to understand
@dksharktooth
@dksharktooth 9 жыл бұрын
Good tutorials. Use 1.5x speed if he's going to slow for you.
@theSagarM
@theSagarM 8 жыл бұрын
getters and setters are preferred because this way you can keep the *variables* private (makes application more secure), and set or get the values by using public methods.
@Jukeboxpunk1
@Jukeboxpunk1 7 жыл бұрын
Sagar Mishra you can just make get as public not the set because anyone can set the value of your variables
@Hikkbcfhn
@Hikkbcfhn 5 жыл бұрын
you are a great tutor , cleared my confusions by showing the difference between the two codes and explained it very well!! thank you
@SmartProgramming
@SmartProgramming 6 жыл бұрын
its very simple to understand from your tutorials sir, specially practical work, great 👍👍
@fidgetspinner1403
@fidgetspinner1403 5 жыл бұрын
Can you please do a similar tutorial where we can use arrays and taking inputs of the students int, name and age and to also be able to assign a desired number of students? This would be awesome. Keep up the great work. You make things easy to understand. So much easier than my teacher at university.
@heathicus2234
@heathicus2234 6 жыл бұрын
thank you so much! I will pass my test tomorrow thanks to you :))
@Kiviro
@Kiviro 8 жыл бұрын
i am also a beginner and i am study from eclipses as i am following him
@rajanlurrey
@rajanlurrey 4 жыл бұрын
You are really awesome man
@alexschmidt4371
@alexschmidt4371 5 жыл бұрын
6:54 syso control + shift It is not working for me, how is it done? Edit: I found out that I can type syso and press Control + Shift + Space at the same time.
@DJABA
@DJABA 5 жыл бұрын
Control + Space is the shortcut :)
@alexschmidt4371
@alexschmidt4371 5 жыл бұрын
@@DJABA Yeah it seemed to be changed via new updates releases thanks mate
@silasdietrich7464
@silasdietrich7464 4 жыл бұрын
@@alexschmidt4371 try typing the letters 'sout' and then enter (should be the first option)
@alexschmidt4371
@alexschmidt4371 4 жыл бұрын
@@silasdietrich7464 Oh, I forgot about this comment. However, I already found the solution it was syso then Control + Shift + Space. Thank you for your help I will consider editing the comment.
@sabysreya
@sabysreya 8 жыл бұрын
Very nice work and kudos for teaching us the core topics in easy way. way to go!
@quitbycode789
@quitbycode789 4 жыл бұрын
This is such a helpful tutorial on classes and objects! Love it! No better feeling than helping people learn :)
@therock8408
@therock8408 4 жыл бұрын
Hey I am a beginner in programming ...should I follow this course or should I need to learn c or cplus plus ...please guide me bro
@abhishekmatta6539
@abhishekmatta6539 8 жыл бұрын
how does getter and setters protect from data corruption please explain? a programmer can change id, age,name in both the cases u have shown
@FaithBiete
@FaithBiete 7 жыл бұрын
Yes I really want to know this
@Jukeboxpunk1
@Jukeboxpunk1 7 жыл бұрын
abhishek mahtta he forgot to mention the access specifiers for instance variables + set methods to private and get and set as public
@Jukeboxpunk1
@Jukeboxpunk1 7 жыл бұрын
abhishek mahtta these ide development tools make things easier to layout code but fir in depth study best guide is documentation
@abhishekmatta6539
@abhishekmatta6539 7 жыл бұрын
THANks bros for supporting
@jakethesnake565
@jakethesnake565 4 жыл бұрын
if it wasn't for these videos, ide be struggling in my computer science class. Thank you for the awesome content
@gradyhodge8517
@gradyhodge8517 5 жыл бұрын
Excellent, brief, and clear. Good Job! I'll be searching for more of your videos.
@onthatilemabe7300
@onthatilemabe7300 4 жыл бұрын
my teacher doesnt teach so im here for help! THANK YOU!!
@andy60133
@andy60133 4 жыл бұрын
Thanks for the video i understood this by yr video otherwise i was badly confused...
@leonardofabio2281
@leonardofabio2281 7 жыл бұрын
Buenas noches, el video fue muy sencillo y bien explicado, gracias por aportar tu conocimiento y experiencia. Desde Venezuela.
@gamingclips2173
@gamingclips2173 4 жыл бұрын
Really good tutorial go to 2x speed if he's going too slow because that's what I use and it's just brilliant
@milankbudha
@milankbudha 4 жыл бұрын
thank u very much..it was very helpful and so easy to understand..
@chrisjameson2001
@chrisjameson2001 3 жыл бұрын
Thanks I understand it just a little bit better now.
@Nop1337
@Nop1337 7 жыл бұрын
thx man! it really helps me to understand class and object in java. keep it up the good work!
@makunzinyalunga5852
@makunzinyalunga5852 9 жыл бұрын
TX, nice & easy to follow, when are you doing the advanced part of Java i.e. Networking, Database and etc.
@pavneetsidhu9455
@pavneetsidhu9455 10 жыл бұрын
Keep on going dude! these really helped.
@KevinMThomas
@KevinMThomas 8 жыл бұрын
I agree with +Michael Saneke can you create a tutorial for creating an address book GUI with a table you can sort by field and add, delete, sort, search, etc? Without using Eclipse only a text editor?
@vinu0051
@vinu0051 6 жыл бұрын
Sir, U have shown the use of getter and setter methods. My query is can we get input from user for id, name and age using scanner object in one class and call the methods in second class which has main method. Thanks in advance.
@kenishajones4801
@kenishajones4801 10 жыл бұрын
This was very helpful!Thank you!!
@kiranpotluri
@kiranpotluri 5 жыл бұрын
Good explanation my friend. I did a 2X speed guys, if he is teaching for beginners
@jamilhfl
@jamilhfl 6 жыл бұрын
Good Java learning tutorial.
@bogdan-dm.7627
@bogdan-dm.7627 5 жыл бұрын
In the class declaration, you need to add "private" before variable declaration so they cannot be accessed. The way you showed in the video they are still accessible by unwanted users.
@DJABA
@DJABA 5 жыл бұрын
You need constructors if you use a private class. He'll cover it later I guess?
@govindmishra910
@govindmishra910 8 жыл бұрын
Hatts off bro.....Appreciate ur work ...Thanx alot for it
@fhdhejeh63
@fhdhejeh63 4 жыл бұрын
So Basically we create a separate class and we declare some attributes there. Then we call this sub class into the main one, assign to it an object and then call the attributes of the subclass to each object?
@SoldierGirl68W
@SoldierGirl68W 5 жыл бұрын
This has been tremendously helpful, thank you so much! If I were to do this using notepad since my college class requires us to not use a compiler, when I create separate classes, are they separate notepad files that I just put in the same folder? Thanks so much!
@thomaslinssen1426
@thomaslinssen1426 6 жыл бұрын
Great explanation. Thank you.
@mchinnayya
@mchinnayya 7 жыл бұрын
Sir I am getting error by - student canot be resolved to a type, please help me.
@markolorenzodelgado4051
@markolorenzodelgado4051 3 жыл бұрын
thanks for the explanation!
@naralaarchana8480
@naralaarchana8480 7 жыл бұрын
Very easy to understand tqq u so much sir
@StormWolfET
@StormWolfET 6 жыл бұрын
Thank you very much, super helpful video
@alenadmitruk6413
@alenadmitruk6413 7 жыл бұрын
I think you are teacher from God☝👏
@sivagamasundari8017
@sivagamasundari8017 9 жыл бұрын
Hi..Its a set of very useful lectures...I would like to know how data corruption is avoided here with getters and setters because here also we are trying to hard code inside set method in myclass.java?..forgive me if this is juvenile as i am trying to learn java
@avinashrachamadugu647
@avinashrachamadugu647 8 жыл бұрын
Sivagama Sundari . He meant that data type of the instance variable cannot be changed. You can make the instance variables PRIVATE from PUBLIC and you can use getter,setter methods to access them.
@HindiRiddlesForFun
@HindiRiddlesForFun 5 жыл бұрын
mark is not the object or instance it is refrence variable which carries the refrence id of the object ::)
@josemunguia5660
@josemunguia5660 7 жыл бұрын
GREAT VIDEOS! THANKS!
@Ladoaarna
@Ladoaarna 7 жыл бұрын
Is Getters and setters can be done with normal command prompt
@Sara-s-playground
@Sara-s-playground 5 жыл бұрын
thanks, but which of these classes is testclass here??
@venkatmohith8241
@venkatmohith8241 7 жыл бұрын
sir,if we havent use getters and setters in the student class..they cant be used in my class?
@rjvnz
@rjvnz 8 жыл бұрын
Hi, thank you for this wonderful video. I was so confused trying to understand classes using textbooks and this was gold. Just a quick question: Shouldn't tom.setId(2)? In your video, tom.setId(1) which I'm guessing will override Mark's id?
@aagg5410
@aagg5410 8 жыл бұрын
+rjvnz yes it should be tom.setId(2)
@Moz31
@Moz31 8 жыл бұрын
It won't override though, theyll just have same ID
@FUM80
@FUM80 5 жыл бұрын
dude put a new battery in smoke detector
@Prathm07
@Prathm07 2 жыл бұрын
Can we create Object outside the main method ?
@chetanmotghare7657
@chetanmotghare7657 2 жыл бұрын
some people dont like indian accent. but here enjoying the video
@danimajor5110
@danimajor5110 6 жыл бұрын
i use jgrasp... when i try to call the getter method in the main i get errors "saying value not found" for the .getName and .getAge methods even though they are in my Student class. Any help?
@ArkoSarkar1
@ArkoSarkar1 6 жыл бұрын
Can someone explain why is it important to go the getters and setters way rather than accessing the values directly?
@nicmaoury6822
@nicmaoury6822 8 жыл бұрын
Why not make the field variables private?
@TheGamingGamerGames
@TheGamingGamerGames 5 жыл бұрын
Thank you for the assistance
@vkgamer5129
@vkgamer5129 7 жыл бұрын
Easy!!! Thanks.
@jain3484
@jain3484 6 жыл бұрын
Thank you!
@aakashbhargava1276
@aakashbhargava1276 7 жыл бұрын
Please Sir, Suggest me correct code for this program .I faced execution error in this code package Calculation; import java.util.Scanner; public class Calculator { static char choice; static int a1, b2 , ad, sb, ml, dv,pr; public static void main(String[] args) { System.out.println("Enter first number"); Scanner num1 = new Scanner(System.in); a1 = num1.nextInt(); System.out.println("Enter sevond number"); Scanner num2 = new Scanner(System.in); b2 = num2.nextInt(); System.out.println("Enter + for addition"); System.out.println("Enter - for subtraction"); System.out.println("Enter * for multiply"); System.out.println("Enter ÷ for division"); System.out.println("Enter # for clear screen"); System.out.println("Enter % for percentage"); System.out.println("Enter calculation choice"); Scanner scan = new Scanner(System.in); choice = scan.next().charAt(0); switch(choice){ case '+': addition ad1 = new addition(); ad = ad1.Add(a1 , b2 ); System.out.println("addition is" +ad); break; case '-':subtraction sb2 = new subtraction(); sb = sb2.Sub(a1 , b2); System.out.println("Subtraction is"+sb); break; case '*': multiplication mul3 = new multiplication(); ml = mul3.Mul(a1, b2); System.out.println("Multiplition is" +ml); break; case '÷': division dv4 = new division(); dv = dv4.Div(a1,b2); System.out.println("Division is" +dv); break; case '%': percentage pr5 = new percentage(); pr= pr5.Per(a1, b2); System.out.println("percentage is" +pr); break; } } }
@rajat.lazyme
@rajat.lazyme 8 жыл бұрын
I am facing a problem....... When i am trying to import any variable from a class it show me a error like id is a variable so it is showing "id cannot be resolved or is not a field."......... Hep me Thanks
@saptangshumanna9919
@saptangshumanna9919 6 жыл бұрын
You could have used private variables after using getters and setters
@sargonmarqos5435
@sargonmarqos5435 9 жыл бұрын
thank you ... really helpful :)
@anilchoundaj1445
@anilchoundaj1445 8 жыл бұрын
Thanks a lot
@amanbagrecha
@amanbagrecha 6 жыл бұрын
is it similar to structures in c?
@nalineeable
@nalineeable 7 жыл бұрын
sir please provide tutorial for struts and hibernate
@pavanbodkhe7865
@pavanbodkhe7865 Жыл бұрын
sir but can we do this all thing in the single class
@uxzh
@uxzh 7 жыл бұрын
In Netbeans 8 i am getting an error with my strings "Colour is erroneous" for example. Can someone help
@nazrulhasanalam9633
@nazrulhasanalam9633 4 жыл бұрын
sugoi desu
@muntazirm1794
@muntazirm1794 4 жыл бұрын
Sugoi sugoi
@nazrulhasanalam9633
@nazrulhasanalam9633 4 жыл бұрын
@@muntazirm1794 wakarimashta
@stephena.olujare6512
@stephena.olujare6512 5 жыл бұрын
I'm beginner, but i still don't comprehend how he explain the "Method Overloading" tutorial.
@georgemwongela6472
@georgemwongela6472 8 жыл бұрын
Thank you
@ObaidMasood
@ObaidMasood 8 жыл бұрын
good tutorial
@masouddayaghi5923
@masouddayaghi5923 5 жыл бұрын
wonderful video but this detectors are really annoying
@anandgupta8529
@anandgupta8529 6 жыл бұрын
you have told that using getter and setter u can secure your data ,but u don't have told how it is doing that. Please focus on logics also
@WINTHEGOLD
@WINTHEGOLD 7 жыл бұрын
hi all while writing code after giving dot after mark in the pop up box id name are not coming .can anyone help me to resolve this issue. I am new to java.Thanks
@maxg70
@maxg70 8 жыл бұрын
I still dont understand why we need encapsulation and how somebody can corrupt the data if int id;String name;int age still existing in the class?
@muhammetaliariturk2115
@muhammetaliariturk2115 8 жыл бұрын
hiya, When i try to setName,id,age with scanner. Id and Age works but for name ; it didnt want me to type a name ! and say " "; " is 2 years old"; thank u
@vinothbabu128
@vinothbabu128 9 жыл бұрын
Good
@iqrazaman8108
@iqrazaman8108 3 жыл бұрын
Yh wala program agr written mh likhy ...toh kasy likhy gy...bcz yh alg classes hai 2
@chadcausey32
@chadcausey32 7 жыл бұрын
Can someone explain which part is missed with protecting your data. Which ones should have been private?
@JHEVR
@JHEVR 7 жыл бұрын
why did he have it on public?
@shaiksameemacosmotology639
@shaiksameemacosmotology639 8 жыл бұрын
ITS NOT GETTING AN output ..its saying student cannot be resolved into a type
@meixiongpeng1460
@meixiongpeng1460 5 жыл бұрын
Whos here before the CMSC 131 final?
@vipin_mishra19
@vipin_mishra19 7 жыл бұрын
how i can create class inside main class using notepad .......
@ashutoshanand4040
@ashutoshanand4040 6 жыл бұрын
Is it inheritance ?
@jonathanselnes2317
@jonathanselnes2317 8 жыл бұрын
get rid of that piping sound, please :P
@swatkowski09
@swatkowski09 5 жыл бұрын
Needs to change batteries on his smoke detector lol
@banugaria967
@banugaria967 7 жыл бұрын
dont we have to have Private instances on other class then its worth to setters and getters there.
@jalajgupta3930
@jalajgupta3930 7 жыл бұрын
why do we use the word "NEW" and what is use of that
@kamalalrashdi4359
@kamalalrashdi4359 4 жыл бұрын
what is the use of new????
@stanislavdimitrov1643
@stanislavdimitrov1643 Жыл бұрын
OK, but I think that it is better to write the Set and Get methods yourself instead of automatically generating them. So, you can learn things better.
@SrinadhYuva
@SrinadhYuva 5 жыл бұрын
Can we use Scanner class ???
@SrinadhYuva
@SrinadhYuva 5 жыл бұрын
An error is thrown when I've used scanner class
@saptangshumanna9919
@saptangshumanna9919 6 жыл бұрын
Listen to this in 0.25 speed...... It's so funny🤣🤣
@shraboniroy8098
@shraboniroy8098 6 жыл бұрын
Saptangshu Manna so true! 😂😂
@nuranferzeli5107
@nuranferzeli5107 5 жыл бұрын
your acces modifier must be private for use setter getter methods
Java Tutorial For Beginners 19 - Class Constructor in Java
10:26
ProgrammingKnowledge
Рет қаралды 421 М.
Classes & Objects | Java | Tutorial 26
13:52
Giraffe Academy
Рет қаралды 147 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 42 МЛН
One day.. 🙌
00:33
Celine Dept
Рет қаралды 66 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 137 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 35 МЛН
#22 Class and Object Practical in Java
15:36
Telusko
Рет қаралды 280 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 831 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 99 МЛН
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
Java Classes & Objects
11:36
Keep On Coding
Рет қаралды 363 М.
Java Tutorial For Beginners 28 - Abstract Methods and Classes
9:18
ProgrammingKnowledge
Рет қаралды 195 М.
Learn Java in 15 Minutes (seriously)
19:50
ForrestKnight
Рет қаралды 132 М.
Java Tutorial For Beginners 25 - Inheritance in Java
14:14
ProgrammingKnowledge
Рет қаралды 298 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 42 МЛН