Java – eclipse – declare variables based on return or get (shortcut)

I don't know how to use this phrase in search, but if there is a shortcut in eclipse that allows us to declare a variable type after equality, I'm curious

For example:

firstname = User.getFirstName();

The moment you enter, it will add "string" to the beginning of the line, so that it becomes:

String firstname = User.getFirstName();

Even a shortcut key is enough

Sometimes, a class name may be very long, or like: iterator < entry < string, string > > it is long enough. A shortcut or automatic addition will be convenient

I don't know if this exists

Thank you very much

Solution

I usually just write expressions:

User.getFirstName()

Then highlight it, press Ctrl - 2, and then press l to assign to local variables

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>