A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • one year ago

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!

  • This Question is Closed
  1. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so would each type of card have its own template?

  3. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.