java - I am getting a null value when i am trying to access a string defined in the superclass from the sublass -


my code is:

public class register_window extends javax.swing.jframe {     string u; . . .     private void jbutton1actionperformed(java.awt.event.actionevent evt)      {         try         {             .             .             u=jtextfield.gettext();              .             .         }     } }    public class data_storer extends register_window {     public vector people_database() throws exception      {         .         .         .          system.out.println("the name of user printed in data_storer(inherited register_window) is:" + u);         .         .         .     } } 

you need initialize u. you're making assumption jbutton1actionperformed called before people_database.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -