A
A
Alexey2018-05-25 03:45:16
Java
Alexey, 2018-05-25 03:45:16

How does a sequence of methods applied to a single object work?

Hello, I ran into a problem in understanding. I’m studying Java and now I realized that I can’t figure out how to make several methods in 1 class so that they can also be used like here:
System.out.println(box1.getClass().toString ().length());
I sort of understand what this line will display for me. But how can I do the same in my class so that I can call several methods in a row.
I apologize for the possibly confusing wording.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
imdeveloper, 2018-05-25
@OwlFury

This is a chain call. Do a return this in the method and then you can call .
Here in the example you can see https://learn.javascript.ru/task/chain-calls , though in JS , but for logic it will do

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question