How extract private static constant in Intellij Idea?

Cherry picture Cherry · Oct 27, 2013 · Viewed 8.8k times · Source

To extract constant I can use ctrl + alt + c, that "extraction" create public constant:

public static final String CONST = "123";

So I need manually type private. Is there a way to extract constant with private scope by default?

Answer

pbaranski picture pbaranski · Oct 27, 2013

Hit ctrl+alt+c twice (shows Extract Constant dialog)

hit alt+v (set default Visibility to Private)

hit enter

Done :) The private scope is set default - so you can use constant extraction as before, to change default scope simply repeat steps above with choosing different scope.