+ 1
How do you create objects without using "new" operation.?
3 Answers
+ 2
I think new objects are created without using the new operator if you clone an object or deserialize from an object stream.
+ 1
There is always somewhere(internally) the new operator called.
However many methods return objects, e.g. Files.newBufferedReader (Path p).
(a method that should be used since java 7 instead of : new BufferedReader (File f))
Also when you init a String you don't call new:
String s="hi";
But generally there is always somewhere the new operator called.
Why do you need this?
0
just to know...new is the only way to create objects or others options we can use it..