D
D
d_coder2014-05-05 08:51:02
Java
d_coder, 2014-05-05 08:51:02

How to correctly implement the method?

I recently started learning Java.
You need to implement the setName method so that it can be used to set
the value of the private String name variable equal to the passed String name parameter.

public class MainClass {
    private String name;

    public void setName(String name) {
/* только сюда можно писать код */
    }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2014-05-05
@d_coder

this.name = name;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question