Java classes,objects and variables
Go to solution
Solved by Slottr,
8 minutes ago, stefanmz said:no I meant
class Foo { variable=value foo(variable){} } Foo obj=new Foo(variable);why does it say variable does not exist?
- Variable isnt local to where you are creating obj
- Variable will need to be public to be accessible AFTER you have created the class
- You need to consider using a constructor upon class creation to set values

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now