package com.codegym.task.task04.task0406;
/*
Name register
*/
public class Cat {
private String fullName;
public void setName(String firstName, String lastName) {
String fullName = firstName + " " + lastName;
this.fullName=fullName;
}
public static void main(String[] args) {
Cat cat = new Cat();
String firstName = "ami";
String lastName = "go";
cat.setName(firstName, lastName);
}
}
verified successfully but showing empty while clicking Run
Under discussion
Comments (8)
- Popular
- New
- Old
You must be signed in to leave a comment
Кайрат Борбиев
4 July 2019, 14:18
if you want to know what's going on
System.out.println(this.fullName);
this.fullName = fullName;
System.out.println(this.fullName);
Cat x = new Cat();
x.setName("asdd", "wqe");
0
Satya Vath
21 March 2019, 05:16
+2
Khurram
7 December 2018, 06:09
The console will only display results when System.out.print method is used
0
Aswini
7 December 2018, 10:06
i got output now. Thanks.
0
Guadalupe Gagnon
6 December 2018, 15:13
Which condition is not passing? Have you tried submitting it with nothing in main?
0
Aswini
7 December 2018, 10:05
I missed to use sysout. now i done that , its showing output now. Thanks.
+1
Abhishek Rangari
6 December 2018, 14:29
There will not be any magic so that it will display you a fullName value. You need to display it using sysout.
0
Aswini
7 December 2018, 10:03
I know this is not magic. I missed to notice that sysout is not used.
Now i used sysout, its showing output now. Thanks.
0