473,499 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nonstatic variable xx cannot be accessed in a static context ---Help Needed Urgently

50 New Member
Hi

I am unable to access a non static variable in a static context

The variable is an arrayList and in a separate file

I cannot change the corresponding non-static class into static class

Please help me to resolve this problem

I have also tried using getter method
Apr 27 '09 #1
5 2945
JosAH
11,448 Recognized Expert MVP
@uhdam
Take it easy; non-static variables belong to an object, an instantiation, of the class. If you don't have an object, you don't have it's non-static variable; e.g. a Person instance has an age; if you don't have a Person object you don't have an age.

kind regards,

Jos
Apr 27 '09 #2
uhdam
50 New Member
Thankyou sir,

But when i created an instance for that nonstatic class and accessed through that instance i am getting the ArrayList size as zero.
Apr 27 '09 #3
uhdam
50 New Member
Please Reply soon sir... I am in need of it badly...
Apr 27 '09 #4
JosAH
11,448 Recognized Expert MVP
@uhdam
Top level classes (not nested) can't be non-static or static; they just exist. I don't undrerstand your question. And where does that ArrayList come in?

kind regards,

Jos

ps. no need to try to rush us.
Apr 27 '09 #5
dmjpro
2,476 Top Contributor
It would be better if you shown us the code.
Please show us the code ;)
Apr 28 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1443
by: Kamliesh Nadar | last post by:
Hi I am developing a software using VB.NET I am facing following problems - 1. Though I have placed the NotifyIcon control on the window service application, after starting the service I am...
15
3334
by: Alfonso Morra | last post by:
Hi, I have some code from an example, that I want to retrofit into my project. The code from the example has the following line: SharedAppenderPtr myAppender( new...
0
976
by: Amit | last post by:
hi friends , I am stuck with a problem and need ur help. I have knowledge management application where i am using third party forums that needs login.I have username and password for forums...
2
1181
by: walterd | last post by:
Hi Can anyone help me with the following problem. In my web application, I have a class that use the MessageBox class to display messages. My only problem is, messages pop-up on the server...
1
8907
by: Patrick F | last post by:
I keep getting this error message and i don't know whats the problem is and how to solve it. I have a webproject with 2 components (dll) added to it. One is called PhotoGallery and one is called...
3
1081
by: gauravkg via DotNetMonster.com | last post by:
Hi i have a problem I have a product product_name=taj Mahal product_id=111 i and different users will be putting reviews title and review description. this is the following xml file i...
0
2523
by: hudhuhandhu | last post by:
have got an error which says Input string was not in a correct format. as follows.. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
0
2944
by: prad | last post by:
Hi, Following java code returns 24 result sets.It counts number of rows in the first result set correctly.But doesnt count rows from next result set. When I debugged the code I found out that...
10
1550
by: Silvana | last post by:
Hi, I'm new to Access or as a matter of fact it's the first time that I'm working with a database. I'm working on a program in Access for a class project and I'm having some trouble with the login...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.