You mean something like this: package testacm; import javax.swing.JFrame; public class TestFrame extends JFrame { public static String fooString = "fooString"; public static void main(String[] args) { TestFrame frame = new TestFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 500); frame.setVisible(true); frame.doSomething(TestFrame.fooString); } public void doSomething(String str) { // Do something } } If so then answer is: yes you can, but depending on the problem ...