+ 4

Define an object with an example??

4th Jul 2020, 1:51 PM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar
9 Answers
+ 13
So, let me explain it with the help of an example, suppose rose is an object of class flower so here's the syntax of creating an object : < Class name > < Object name > = new < Class name > ( ); So here it is :- flower rose = new flower ( ); So, flower rose = new flower ( ); | | | | Class object. Operator constructor So here the new keyword is used to allocate space in the dynamic memory for the storage of data and functions belonging to an object. I hope it's clear to you now😀
5th Jul 2020, 1:58 PM
💖Miss Angelic💖
💖Miss Angelic💖 - avatar
+ 11
https://www.sololearn.com/discuss/1043052/?ref=app //Example public class AryaDeep{ int b=60; public static void main(String[] args) { AryaDeep o = new AryaDeep(); System.out.println(o.b); } } https://www.w3schools.com/java/java_classes.asp
4th Jul 2020, 1:54 PM
Nilesh
Nilesh - avatar
+ 5
Arya Deep Chowdhury Yes bro it will be o
4th Jul 2020, 2:18 PM
Nilesh
Nilesh - avatar
0
Nilesh, bro it will be System.out.println(o.b);
4th Jul 2020, 1:59 PM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar
0
~ swim ~ , Yep!, you are right but u didn't got me actually I am looking for kind of definition.
4th Jul 2020, 2:03 PM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar
0
~ swim ~ yes its given there
4th Jul 2020, 2:06 PM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar