A bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. A single name isn't enough. You can change your display name here. Thanks!
Not in Java. Sometimes it is a little hidden like a factory or singleton pattern implementation, but at the point where an object is created, there is a new there. This is not the case in C++ though, which causes confusion sometimes.
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Originally posted by Rusty Shackleford: Not in Java. Sometimes it is a little hidden like a factory or singleton pattern implementation, but at the point where an object is created, there is a new there. This is not the case in C++ though, which causes confusion sometimes.
Find the "new" in Class.newInstance. You'll find it calls a native method, so it is possible. For the average developer, new is the only way.
Yeah, that may or may not create a new object. But it's an exception to "for the average developer, new is the only way." Here's another:
That does end up being equivalent to
but in terms of Java source code, it's not using "new". I'm not sure if that counts, depending on what the original poster really wants. I think Dana's question is fairly important here: laxmidhar, why do you ask? We can debate minutae about borderline cases, but without a meaningful context for the question, it doesn't much matter, I think. [ September 01, 2006: Message edited by: Jim Yingst ]