JMenuItem print = new JMenuItem("Print");
print.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK));
I'm new to java. I have learned that if we want to access the contents of class then we have to first create an object of that class. Then we can use that object to access the class's contents.
But here KeyEvent and ActionEvent are classes and they can access their fields VK_P and CTRL_MASK without the help of any object. How is this possible?
 
     
     
     
    