wood burning stoves 2.0*
The moose likes Java in General and the fly likes Object creation at Compile time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object creation at Compile time" Watch "Object creation at Compile time" New topic
Author

Object creation at Compile time

Anil Chandran
Greenhorn

Joined: Apr 11, 2005
Posts: 15
Can we create objects at compile time?

Or in a simple sense

String s = "hello world" ;

When is the object created ? Runtime or Compile time ?

Thanks in advance

Anil


I started out with nothing..I still have most of it ...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

All objects are created in the Java VM, while it is running. Some objects, like the String shown here, are created in the VM while a class is being loaded, so it's effectively created before your program code runs; but it's still created at "runtime."


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object creation at Compile time
 
Similar Threads
Roundup q.26 assignmtn of superclass to subclass
Printing the datatype of a variable
Polymorphism
Is it "Exception at runtime" or "Compile Fails" for this one?
Doubt with String method "replace"