#what happened here? and how? and are there other ways to avoid this error? what are they?

33 messages · Page 1 of 1 (latest)

weary whale
rocky jayBOT
#

This post has been reserved for your question.

Hey @weary whale! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

cinder haven
#

yeah no this isn't going to get any different answer

compact saffron
cinder haven
#

no one's going to be able to answer this to your satisfaction without explaning how fundamental logic works, the same logic you already know and use

weary whale
rocky jayBOT
cinder haven
compact saffron
jagged graniteBOT
#

class Student { int rollno; String name; int marks; }

This message has been formatted automatically. You can disable this using /preferences.

weary whale
#

solve the issue?

rocky jayBOT
# weary whale solve the issue?

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

cinder haven
#

oh my god we're going in circles

compact saffron
#

because you defined what a Student is. Before you were just telling the compiler to use the type Student however, the compiler had no idea what student was because there is no class defined for it.

cinder haven
#

inb4 exact same thing happens as last thread 🍿

weary whale
#

to define variables?

compact saffron
#

classes are a structure. They logically bundle variables and methods together

cinder haven
#

check this out buddy

#

i remember you asking questions here, you were so much farther along, what happened

weary whale
#

or do I always have to create separate classes?

#

and are there other options to define variables?

cinder haven
#

ah love it when you're blocked from giving links

#

@compact saffron just resend the link i gave it'll probably work lmao

compact saffron
#

you should always group variables and methods in logical bundles aka classes. If you have a class that has hundreds of responsibilities and variables to keep track of nobody, including you, is going to understand what you are coding. I wholeheartedly recommend the link above, the article will get you started with the basics.

cinder haven
#

he's not gonna see the link just resend it

rocky jayBOT
# weary whale alright thanks

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.