java - Syntax error, regarding to changing variables in an object from a class -



java - Syntax error, regarding to changing variables in an object from a class -

class anyname { int tcol = 0; int fc = 0; int x = 0; float randx = (random(1, 1000)); float randy = (random (0, 600)); int tsizes = 1; { if (fc >= x) { //random ellipse 3 stroke (tcol); fill (tcol); ellipse (randx, randy, tsizes, tsizes); } } } anyname ranx1 = new anyname(); ranx1.x = 100;

hi, trying add together class/object code , not working. class have far, when instantiate 1 object class (ranx1), , seek alter 1 of variables within (x), says there error. there need change? appreciate help.

since instantiated object class, how alter variables new object? example, if in class x = 0, made re-create , time want x = 100, other variables such tcol , fc remain same. know possible because teacher taught it, not working right me.

i newby programmer, think should easy answer.

if want entire code, please set email in answer, can email entire thing you.

ranx1.x = 100;

you need setter in anyname-class. , phone call setter:

public void setx(int x) { this.x = x; }

and

ranx1.setx(100) example.

java class variables object processing

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -