BelajarJava.Com


How To Create New Object

Posted in Fundamental by jolly on the January 21st, 2009

First of all, for someone new with Java programming language must be have no idea what is “Object” term in the title means. Java programming language is Object Oriented Programming (OOP) base, it works like a real life in the world. So, what is the object in the real life? I’am an object, every people is object, your nokia N series is object, my SonyEricsson is object. We can say everything in our world is an object. There is higher level than object, that is Class and an object is representation of Class. This is my best analogy to describe the relation of class and object. In the real world, Human categorized as class and individu named Simon for example categorized as object. So let say that “Simon is an Object of Human Class“. Human typically has attributes such as two arms, two eyes, one nose, has hair and so on, so that Simon as an object of Human has them too.

In OOP also has Class and Object term and the relation between both of them already explained above. Simon in reality is God’s hand-made but sure Simon also can make his object to. Let say Simon is Java Programmer and he want to create an object. In Java language, to create an object you have to have a Class first, so Simon create his class named Human then he may start to create a new object from it. (more…)