Java Tutorials || Java OOPS || Encapsulation || by Durga Sir

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] you star in the last two videos we covered about data hiding under abstraction what is data hiding outside person should not access our data directly by declaring private variable but by declaring variable at the private we can implement data hiding what is abstraction okay hiding internal implementation just a highlight the setup services what we are offering is a concept of what abstraction now the next concept what we have to talk yes yes take very very special care young capsulation this word is very important for the exam sake even for interview room also right Yin Yin capsulation forgetting encapsulation can you please tell capsule capsule sir Wadi da meaning of capsule can you can you please tell capsule sir have you ever use of the word capsule now if you are feeling cold the cold then immediately we are going to use cold the actor capsule collect the cold egg the capsule sir how the collect the capsule looks like do you know something like capsule medical mixing capsule looks like okay colorful medicine by default will be there inside the sub disease this is a cold egg to collect capsule one capsule like you know whatever medicine required to cure collector that that medicine is going to be here encapsulated regarding is going to be group photo he is going to be group put into this capsule forgetting capsule is an ultimate one one group one unit to unit okay sir all the required things group water into one capsule easy easy easy nothing multi system it is medicine capsule right CMV sir what is capsule yet program what is n capsule encapsulation yet programming very simple sir Assunta suppose student is there student student is there for every student some data members are there and some behavior methods are there something like student name roll number marks are data members next I get a much update marks read/write these are things are naughty much student behavior buckling the process are of encapsulating grouping data members under corresponding methods into a single unit suppress example here I'm taking for every student name will be required name is required for every student age next rule number roll number Maxo required roll number marks required name age rule number box adequate plus plus for every student corresponding methods ok read the method is there ok write the method is there like that spawn emitters dissipators i want to group into a single unit that unit itself is a nothing but class a' student forgetting student a class contain student a related data student or related behavior the process of grouping grouping combining data members under corresponding methods of behavior into a single unit which is nothing but the encapsulation be able to understand a capsule grouping mechanism itself is like this thing sir give free java class you free java class he's an example of encapsulation so from our children words in the books if you open any book then it's going to tell us what the meaning of encapsulation this itself is a nothing but encapsulation the process of grouping data members and the corresponding meters into a single unit either concept of encapsulation you freak java class is an example for encapsulation and it out are you able to understand theoretically right now the same concept a bit more practical orientation just observe so some some in in reality in reality what is encapsulation very simple sir if any component if any component follows follows data hiding under and abstraction sir last two oopah features whatever we covered one is data hiding like a button second one is one huh abstraction we covered if any component follows data hiding under abstraction that a component is said to be encapsulated component forgetting if any component follows data hiding and abstraction that component is said to be encapsulated component sir now observed on I can use the war young capsulation encapsulation is equal to data hiding encapsulation is equal to data hiding plus abstraction data hiding plus abstraction is itself yes encapsulation right data hiding plus abstraction itself is what encapsulation so if any component follows data hiding and abstraction which is anathema encapsulation theoretical okay sir can you please explain a small shorter program to demonstrate this encapsulation right no let me take a small example I am taking class yet on the sir observe very carefully class account account for every account for every account private double balance balance field is there private a double balance balance field is there sir now these are balance of variable cannot be accessed directly by outside person because the reason yes private remember this one baccata reason is private outside person can't access these data directly that's why it is the private okay data hiding next hold our own say person can able to access compulsory we have to provide getter and a setter me that's for this variable okay now I'm taking get balanced public public double get a balanced public double get a balanced get balance balance no really did really did validate surfer form required validations because so with these personally the character person on on ask is username and password and so on yes very if for this person is very irate am balance if for this person is a valid return balance balance like this right no sir I want to update my balance I want to deposit I want to update my balance something like public public void public void okay so I want to perform with operation I want to perform with operation assume that sir ah sir I want to change my balance set a balance sheet balance double balance double balance like this right okay boss can you please withdraw so on so amount are can you please deposit so on so emote like so here also you can perform that required validations okay you put that deposit if it is a deposits are these are data balance is equal to balance these not balance is equal to sir these are our balance a balance ax is equal to is equal to surveillance these are our balance plus a amount whatever you want we are going to provide it sir assume that you moon so Kareem the balance current the balance plus the amount plus the amount like this we are going to take that's how a simple example a simple example I have balance variable is there these balance variable declared at the private I would say person should not access our data directly next how does a person can able to access server using get remanded on Sepulveda the advantage of providing access through getter and setter methods is either sir we can perform the required validations forgetting I would say person is always going to come either get balance our said belém so true that after validation then only he can able to get that required the data are you can able to perform required operations right so now I can use the word it is a best example for encapsulation regarding example for encapsulation now I have bigger entities there if you are telling it is encapsulated component compulsory it should follow data hiding under abstraction compulsory should follow data hiding and abstraction serve varies and data hiding yes yes we needed a tiling declare this variable and the private data hiding okay well perfect but various abstraction yes friends varies abstraction how you can conclude yes this is obstructed our abstraction is there in this example remember remember that okay so I never gone to Haley DISA get balanced asset balance functionality to outside person directly what I will do I will stop provide serve on GUI screen to the end-user GI screen maybe JSP base and are are otherwise some irritability swing space somewhere somewhere okay some GI scream ilda balance inquiry there is one button is there sir balance inquiry button there is another button is there okay depose it something like whenever end user whenever end user and user click a balance inquiry no get the balance method will be executed whenever end user click balancing query then get balanced me that will be executed whenever end-user clicker deposit deposit can set the balance method will be executed forgetting whenever any user click deposit set balance method will be executed but the end user don't know internally which code is executing which methods are executing the end user can able to see only these two buttons internally is it Java code at and for Python code ah so you don't know anything you don't know anything about that just you should be is going to click that self then acquire functionality in the background is going to it's secure we never go to highlight our internal implementation to the end-user are you able to get right that's why I can use the word it is a sir what we call abstraction so they are hiding an abstraction which is nothing but encapsulation everyone can able to understand such two definitions I provided right sir what is the definition one what is the definition one grouping data members and the corresponding methods into a single unit either concept of encapsulation theoretical thing if any component follows data hiding and abstraction that component is said to be encapsulated component sir test example there declare data member at the private and the forgiver e data member provide getter method under setter method ok like under we can provide access through some GUI screens itself is a nothing but ok encapsulation type some of you have shown here on one small thing you people should evasion is it possible to y-axis these are data member directly can you please confirm is it possible to access at least a data member berri Reckling no outside personal context yes right so if I would say put some more tea access yes locale get pelham subset balance method so true get balanced on set balance only we are going to provide our data that's why get the balance on set balancer so eita improv is for outside person internally our balance data is going to come that's why I think that data behind the methods can you please observe my statement very carefully sir hi eating the data behind the methods either concept of encapsulation remember these ones are high eating the data behind the methods either concept of encapsulation who can like now here there are two important conclusions are there what is the advantage of encapsulation what advantages are it okay what even advantages are there for data hiding and abstraction all those the advantages are advantageous for encapsulation because encapsulation is not a new word it is the data hiding an abstraction only that's why first the first of our security we can able to hu or we can able to get security second one the enhancement will become very easy without affecting outside person without affecting outside person we can able to perform any type of changes internally enhance man okay good one sir third one the piston what we are going to get maintainability of the application modularity of the application will be improved are getting maintainable table to be improved motility of the application will be improved sir D Sita advantages for encapsulation but anyway among all these things the main important advantage whenever we are using data hiding an abstraction our encapsulation the biggest advantage work we are going to get security the first group are oops concept is security main target the word security rate dividing our abstraction or encapsulation security is the important word okay well no there is one more small point is there if you are keeping something compulsory universal rule we have to me something getting if you want to get something you should me something some what we are going to get because of encapsulation what we are getting because of encapsulation security we are getting but what we are going to miss because of M capsulation yes we have to compromise we have to compromise we have to sacrifice something generally we are going to get certainty security what is that yes Soho forgive for a beta member compulsory required to provide get a matter matter you free bang relations must be require valuations must be require then only I can able to perform the quad operation it increases length of the cord validation if repair validation validation validation if increase yes length of the cord slows down execution forgetting so I want to get balanced so best example if you want to know your account balance you are the valid customer you are valid customer of the bank but still you can't get to directly give an account balance you have to provide your username password then only you are going to get so validation must be required afferent yes if you want something you should be something here you are quoting at security but it is going to time-consuming process performance is going to be down remember that so that's why so if freeware don't make you implement security don't try to use the encapsulation if the security comes nineties there then only we require to your encapsulation sir best example I want to perform funder transfer to my a friend account 10,000 rupees assume that's a 10,000 rupees funds are transferred I want to perform indices a banker to perform funds transfer of 10,000 rupees how many activities you have to do you have to provide your username password next and a proton booty P you are going to hear next in your card backs a grid you have to enter some numbers you require enter some number after doing all these things after three minutes or four minutes you can able to perform you can able to complete transaction of 10,000 rupees forgive our friend forgetting so the problem time-consuming performance is done but it won't be right person only can able to perform function transfer security by default you're going to get clear any doubt about this one so three words you should aware what is encapsulation what is the advantages of encapsulation what is that disadvantage of encapsulation these are things you people should be aware very clearly right sir can you please observe the process of grouping data members and the corresponding methods into a single unit is an ultimate encapsulation next what we call if any component follows data hiding and abstraction is a concept of encapsulation hiding the data behind the methods either concept of encapsulation advantages security enhancement will become easy maintainable team modular T will be improved the bigger problems with this year sir performance is going to be down because it is a time-consuming length of the code is go always going to increase because where lesion loss has to execute that's also clear falafel a very important is encapsulation word for the exam sake even for intramural also nipitiri come but compulsory you should aware
Info
Channel: Durga Software Solutions
Views: 169,336
Rating: undefined out of 5
Keywords: durgasoftware, object oriented programming java, oop java, oops concepts in java, abstraction in oops, features of oops, encapsulation in oops, oops concepts in java with realtime examples, oops concepts in java with examples, encapsulation in java with realtime example, features of oops in java, data encapsulation in java, oop principles java
Id: tjyZWqJkNpc
Channel Id: undefined
Length: 19min 27sec (1167 seconds)
Published: Sun Sep 01 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.