0

For example, I want to type something like below in Jshell

new Random().nextInt()

and then use a keyboard shortcut to generate a local variable with the correct return type.

int x = new Random().nextInt()

Is there any in-built or user-defined shortcut to achieve the above? if not any workaround?

  • 1
    not sure if that helps, but if I recall correctly, every time you type the first line and press enter, a variable(`$1`) that you can reference in that session is generated – Naman Aug 20 '20 at 11:34
  • Yes, you are right. However, here, I am rather interested to see the type of variable especially if it is a complex type. eclipse provides similar functionality with the keyboard shortcut "ctrl+2, L" – Janaka Buddhika Aug 20 '20 at 12:03

0 Answers0