Suppose we want set a mnemonic for a menu item, and we want it be 'c'
. I notice in almost all codes they write it as:
menuitem.setMnemonic(KeyEvent.VK_C);
I know that we can write it like this:
menuitem.setMnemonic('c');
However, the first variant seems to be more common. Why is that? Why don't we just use simple characters instead of something like KeyEvent.VK_C
? What advantage have the first code over the second?