Java related | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java related

what do I need to to print an object like TestServer user = new TestServer(); system.out.println(user); do i need display method or toString method for displaying my user?

23rd Jul 2017, 6:51 PM
lucky fethetsane
lucky fethetsane - avatar
1 Answer
0
You have made an object called user. Now you can display its properties or methods if they exist in TestServer Class. for example if TestServer has a variable named String name = "ABC"; Then you can display it by System.out.println(User.name);
23rd Jul 2017, 6:58 PM
Yasir Khan
Yasir Khan - avatar