4
Reply

How to create object of Class ?

Sandeep Kumar

Sandeep Kumar

Dec 19, 2015
522
0

    Syntax:- class_name variable_name(or)ObjectName = new class_name( ); Example:- Birthday ObjMessage = new Birthday( );Birthday ->Class Name.ObjMessage ->ObjectName. by using this objectname we can access all methods available in that class.If method is public means we can access it throughout the application.if method is private means we can access it within the class file.if method is public means we can access it within the class as well as derived class.

    Paul
    October 25, 2016
    1

    YourClassName object=new YourClass Name();

    Munesh Sharma
    May 31, 2016
    0

    For this you have to know, what is Object actually... An Object within Object Oriented Programming is an instance of a Class. Objects (instances) are created from the Class using the keyword "new". You can create as many instances of a class as you would like. When a new Object is created, then memory will be allocated for the class in heap memory area, which is called as an instance and its starting address will be stored in the object in stack memory area.Now you can create a object of class like this.....ClassName clsname= new ClassName();

    Dharmendra Rai
    January 06, 2016
    0

    Syntax for creating object of class is : Class Name object=new Class Name();

    Sandeep Kumar
    December 19, 2015
    0