+ 3

What exactly is OOP?

Last couple of months, I've been reading some books regarding Java. But I still don't quite understand Object-oriented programming. Thanks!

9th Jun 2017, 7:52 PM
Limpheus
6 Réponses
+ 6
object-oriented means, everything is packaged inside objects. In Java you have classes, and you make new objects from those using `new`. Thats how everything in Java is done - everything you work with is an object, with .methods() and .properties. You don't need to have classes/objects in a language - check out C, Prolog, Haskell - but Java does, so it is object-oriented.
9th Jun 2017, 7:58 PM
Schindlabua
Schindlabua - avatar
15th Jun 2017, 11:40 AM
Iwan
Iwan - avatar
+ 3
Hm, I'd say so, yes. However, as soon as you use Java there are tons of predefined objects floating around for you to use (you've probably heard of System.out.println) so you could argue one way or the other. But there's no clear definition, and I don't think that debate matters much.
9th Jun 2017, 8:15 PM
Schindlabua
Schindlabua - avatar
+ 2
Does that mean that when you got a Java program, only using one class without other defined objects. It isn't an object-oriented program?
9th Jun 2017, 8:03 PM
Limpheus
+ 2
Okay, well this really made OOP much clearer for me. Thanks for your help!
9th Jun 2017, 8:18 PM
Limpheus
+ 2
Objects are a very nice concept, because they can have attributes and certain things you do with them, like if I had an class Computer it could have a string variable colour and method boot(), it is almost as if it were a real object. In java everything is defined as object, but isn't always like this in other programming languages.
9th Jun 2017, 9:43 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar