Skip to content
Sign upLog in
← Back to Community

How would I make this work?

Profile icon

I want to create a new class to store variables & recall them but it doesn't work, is there a way to fix this or should I try a different way? Thanks!

Answered by SixBeeps [earned 5 cycles]
View Answer
Profile icon
Profile icon

You have two options:
1.) Move dont_work work = new dont_work(); into the main function
2.) Mark work as a static variable

Right now, work is an instance variable of the Main class, but because main is a static function, you're not allowed to use it.

Profile icon

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. étapes de création d’un site web

Profile icon

Very useful info. Hope to see more posts soon!. เว็บ พนัน อันดับ 1