+ 3
Friends can you help me to understand this, please 😣😢
Friends I had started to learn java but I understand nothing in (object oriented programming ). can you please explain me this in easy words. wait for your help.
2 Antworten
+ 2
a program, in the simplest way, takes data, processes data and outputs data. the data is represented as variables, that's where we store the data. then there are functions, conditionals and loops with which we process the data.
now, each language has it's own predefined data types: integer, float(ing point), array etc. in object oriented programming you have the option of creating custom type "variables" or objects to suit your needs, which may contain those primitive variables and also functions (functions inside objects are called methods). why would you do this? maybe because it's easier to work with that entity and/or you want the variables inside that object only to be reached from inside, i.e. they can't be reached/modified from the outside (data hiding).
an example/analogy i often use: a bank account! each account consists of an account number, name of the owner and the money stored within (these are the variables). you can transfer or receive money (functions). and you wouldn't want anyone from the outside to access your money, only you can make transactions once you're inside your account and other people can't access your data from their accounts (data hiding).
this way, an account object is a custom made template from which many objects can be created. all bank accounts share the same template. so you define an object and create as many "instances" of it as you want.
cheers!
+ 2
thanks @Storm and CHARAN LEo25