1)what are the other ways to create an object otherthan creating as new object?

Showing Answers 1 - 7 of 7 Answers

vvvv

  • Sep 15th, 2005
 

boolean b = false;
int x = 10;
float fl = 10.2f;
String s = "hello";

  Was this answer useful?  Yes

Akshay Kiran

  • Sep 26th, 2005
 

int, float etc are primitives not objects so that part is ruled out.

String s= "hello" is a valid way

other valid ways include reflection

also by using methods that return new objects

Date d= Date.getInstance();

Toolkit tk= Toolkit.getDefaultToolkit();

String s= "hello".concat("world"); etc

Devidas Sonawane

  • Oct 27th, 2005
 

Following ways we can create object in the other way :-

ActionListener listener= new ActionHandlerClaas();

RequestDespatcher rd= request.getRequestDespatcher("file_name");

rd.forward(request, response);

  Was this answer useful?  Yes

SrinivasRao

  • Jan 17th, 2006
 

Using Factory Methods we can create object refference for an class

  Was this answer useful?  Yes

rizwann

  • May 9th, 2010
 

One of the several ways to create an object is using factory methods i.e methods that return new objects. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions