Hi! I'm taking a course on JAVA, and i dont understand what a class is. Why do we have them and what do they do? Can someone help me please!

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

Hi! I'm taking a course on JAVA, and i dont understand what a class is. Why do we have them and what do they do? Can someone help me please!

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

The term template applies. This is in the Java documentation: https://docs.oracle.com/javase/tutorial/java/concepts/class.html As it says there, it is like a blueprint for making objects. Lets take a playing card from a dec of cards. It has a certain shape that all the cards will have. It has a suit, there are only four, and a value, of which there are thirteen. If you need to make just the standard cards, it will always be within those limits. For a computer game of cards, you might use the size to define how it will be drawn on the screen. That basic allocation of size will be the same for all cards. They template for the cards would have that and places to store the suit and value. This template would be a class file for the cards.
so would each type of card have its own template?
Generally, no. If it is a deck of cards, the template would be for a card, which is enough. I made a space game for a school project once. I made a template for objects in space. Then, I made a child of this template that was for asteroids and used that scild template to make lots of asteroids. In this way, I wrote the fact that things needed an x/y positon, alive/dead, and associated image once. The asteroids only needed that much, as did missiles. The player also needed a little more, like total number of lives remaining and speed. oops... yah, asterpoids also had speed, it went up each level... anyhow, it made it so I rewrote the code less because each class was a sub class of the object class and inherited the basic properties needed.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question