Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is an object and how do you allocate memory to it?

Answer Posted / tulasi

Object is an instance of the class.There are two ways by
which a new object is created.

1.using new operator.
example:
classname objectname=new classname;
This allocates the memory to objectname.

This can be classname objectname by which null values are
set to the objectname and not the values as in the class.

2.without using new operator.
Declare the variables as static and also methods used as
static and by using the keyword static we can create an
instance of the class.
Thus, we use public static void main(String args[])in main
program where theres no need to create a class and also
instance of class using new operator.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the term virtual machine?

1032


What are invisible components?.

2128


How many bits is a double?

975


Which package has light weight components in java programming?

1123


How to check if a list is sorted in java?

1018


In java, what is the difference between method overloading and method overriding?

1100


Can classes declared using the abstract keyword cab be instantiated?

1036


What is the use of put method?

933


What do you mean by hashing?

1090


What is command line argument

1181


What is the difference between ArrayList and Vector? which one is better in Java

1117


What is constant in programming?

1090


What comes to mind when someone mentions a shallow copy in java?

1100


What is return null in java?

942


When do I need to use reflection feature in java?

1061