Santhosh Puttu wrote:oh yes. Without creating object we cannot call non static method......
I think this should work..
thank you puttu, you code worked, but i dont undertand why. my constructor still returns a type, which i now remember is illegal thanks to the other comments. heres what i tried before your code, it didnt work, something about non static variables in a static context, but i thought it would work:
Also, the resistance you're printing is the local variable, not the instance variable of your DCR instance.
Rob Prime wrote:Also, the resistance you're printing is the local variable, not the instance variable of your DCR instance.
ok well why is setting the variable in main a static context?
btw main is just to test this function. this is a small part of a larger project, and i need to set the variables in another file
i want to do this the orthodox way so my code is readable, and though putt's code works, it doesnt seem orthodox. my code with the static context problem seems to make more sense to me but of coarse it doesnt work