lets say we have this class without any constructors and instances variables
public class ConsoleWriter{ public void write(){ System.out.println("Console Writing..."); } } and you have another class App with 2 variables console and console1
public class App{ ConsoleWriter console; ConsoleWtiter console1=new ConsoleWriter(); } Now I understand that console1 is an object of ConsoleWriter while console is just a reference type to ConsoleWriter.
When having such case (No constructors, No instance Variable)
what is the difference ?
or how would it be useful to create the Object console1 if we could just do it using the console.
console.write();//would output Console Writing... console1.write();//would output Console Writing...