Initialize an object in java
- by harigm
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