0

Object vs class

Guys what is the syntax of making objects out of a class

20th Jul 2017, 12:50 PM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
5 Answers
+ 10
Class_Name Object_Name = new Class_Constructor; Ex. Fruit apple = new Fruit();
20th Jul 2017, 12:54 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
0
Is wrong to say object vs class. A class is like a sketch plan. And the object is the product of the design. Having a design of something (e.g. Audi A4), you can create how many copies/custom cars. AudiA4 sonsCar = new AudiA4 ("2 doors", "convetible") AudiA4 mumsCar new AudiA4 ("4 doors", "nonconvertible")
20th Jul 2017, 1:00 PM
Claudiu Stefan Haidu
Claudiu Stefan Haidu - avatar
0
Object is an instance of a class. class A { // ... } A object = new A(); // create ana instance of the class A.
20th Jul 2017, 1:08 PM
Raouf Mbarek
0
class HelloWorld{ //... } HelloWorld object = new HelloWorld(); right? do we need to block the object in braces
20th Jul 2017, 1:31 PM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
0
the object does not have braces. Only the class. HelloWorld () is the special method named constructor, has the same name as the class followed by the parantheses. The way to distinguish a class from an object is that the class is always with a capital letter, as well as the constructor. The object is always written with a lowercase letter. The object of a class can access any method or variable ( except the constructor)
20th Jul 2017, 4:48 PM
Claudiu Stefan Haidu
Claudiu Stefan Haidu - avatar