Initialize an object in java

Posted by harigm on Stack Overflow See other posts from Stack Overflow or by harigm
Published on 2010-12-27T06:41:46Z Indexed on 2010/12/27 8:54 UTC
Read the original article Hit count: 133

Filed under:

Is it the right Way we initialise the the object?

I have a class Sample I want to initialise the Object in my Sample1 Class After intialisation I dont require to use the object of Sample Class.

In that Case Can I initialise that object as new Sample(); instead of Sample s = new Sample(); if I am not going to use s anywhere in my Sample1 Class

My question, is this a good practice to do that? will there be any after affects

© Stack Overflow or respective owner

Related posts about java