Declaring Instance Class variable as Static , any problem in Runtime ?
-
Hi, If I have class named "setting_dataTableAdapter" and I want to instantiate this class with a variable settingsAdapter and declare the variable as static, will it be a problem in runtime ? I needed to do that because, this settingsAdapter variable should be a global variable so that all methods can access and at the same time I have static methods who can take only static variables so I had to adopt the following code. static setting_dataTableAdapter settingsAdapter = new setting_dataTableAdapter(); Please let me know your opinion. Thanks.
-
Hi, If I have class named "setting_dataTableAdapter" and I want to instantiate this class with a variable settingsAdapter and declare the variable as static, will it be a problem in runtime ? I needed to do that because, this settingsAdapter variable should be a global variable so that all methods can access and at the same time I have static methods who can take only static variables so I had to adopt the following code. static setting_dataTableAdapter settingsAdapter = new setting_dataTableAdapter(); Please let me know your opinion. Thanks.
i think you are missing public keyword... try the below. public static setting_dataTableAdapter settingsAdapter = new setting_dataTableAdapter();
Where there is a will,there is a way.