public class demo { Public class static void main(String[]args) { //Creating a variable that will be a reference to the object Peoples person_one; //create an object using void method Create_object(person_one); } Public static void Create_object(Peoples object) { Object=new Peoples(); }
I have assembled this code below that has a void method which will creat a new object. Problem I encounter is that inthe person_one has an error saying not initialized. I'm jus trying to learn on my own ways here and practice so may know what's wrong with this? I know I can use a return object from methods but what about this approach?Create_object(person_one);