aspose file tools*
The moose likes Java in General and the fly likes new Operator purpose Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "new Operator purpose" Watch "new Operator purpose" New topic
Author

new Operator purpose

Mohammed Javeed Basha
Greenhorn

Joined: May 22, 2012
Posts: 9
What is the purpose of new operator in java rather than creating objects?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
I presume you meant other than creating objects? Has it got another purpose? I thought that was it.
If you go through the Java™ Language Specification (JLS) contents with ctrl-f-new, this is the only “hit”. Have a look at it. In chapter 18 of the JLS, the word new only seems to appear thrice. Have a look at that, too.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14149
    
  18

The "new" operator allocates memory (on the heap) for a new object and initializes the new object.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Mohammed Javeed Basha
Greenhorn

Joined: May 22, 2012
Posts: 9
Sorry for my english yes other than only, other than creating and allocating memory for objects
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
As I said, I thought that was its only use. If you look for “new” as I said earlier, there do not appear to be any other uses for it.
Mohammed Javeed Basha
Greenhorn

Joined: May 22, 2012
Posts: 9
Thanks for all who replied
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new Operator purpose