promotion image of download ymail app
Promoted

what exactly is a class in java?

I am new to this stuff taking an intro class and I am very confused and I don't exactly understand what it means?

16 Answers

Relevance
  • 1 month ago

    A Class is like an object constructor or a "blueprint" for creating objects.

    To create a class, use the keyword class:

    For Ex -

    public class MyClass {

      int x = 5;

    }

    • Commenter avatarLogin to reply the answers
  • 1 month ago

    A structure for defining properties and methods and instantiating objects, an implementation of OOPS ☀️

    • Commenter avatarLogin to reply the answers
  • Steven
    Lv 4
    2 months ago

    A class, in the context of Java, are templates that are used to create objects, and to define object data types and methods. Core properties include the data types and methods that may be used by the object. All class objects should have the basic class properties.

    Attachment image
    • Commenter avatarLogin to reply the answers
  • 2 months ago

    It is just a blueprint for an object. The object has members, some are data like integers, Strings, other Objects ect. Others are functions that act on the data members.

    Warning: When learning Java, the different versions change over time, it is not too bad but from Java 2 to Java 8 they had Applets, then Oracle ditched Applets for something called Web Start in Java 9,  now with the latest Java from Oracle they have ditched Web Start.

    • Commenter avatarLogin to reply the answers
  • How do you think about the answers? You can sign in to vote the answer.
  • 2 months ago

    Classes and Objects in Java. Classes and Objects are basic concepts of java and Object Oriented Programming which revolve around the real entities. A class is a user defined prototype from which objects are created. It represents the set of properties are methods that are common to all objects of one type.

    • Commenter avatarLogin to reply the answers
  • 2 months ago

    Classes and Objects in Java. Classes and Objects are basic concepts of Object Oriented Programming which revolve around the real life entities. A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type.

    • Commenter avatarLogin to reply the answers
  • 2 months ago

    An intro class is to introduce you to the concept. If it's not making sense to you, speak to the teacher and discuss your problems with him/her.  They don't bite.

    • Commenter avatarLogin to reply the answers
  • Anonymous
    2 months ago

    A container of variables and functions that act on those variables. 

    So instead of having:

    classname_doSomethingFunc(classObject_variables, additionalArgs)

    you have

    classObject.doSomething(additionalArgs);

    Polymorphism is an entirely different concept, no clue why people keep bringing it up.

    • 2 months agoReport

      Very rarely will you see a genius use of polymorphism, in most cases it's just used instead of void pointers, when you need to use runtime indentification for your class to be useful there's no point in making it polymorphic.

    • Commenter avatarLogin to reply the answers
  • Anonymous
    2 months ago

    Not to sure...........

    • Commenter avatarLogin to reply the answers
  • Anonymous
    2 months ago

    A class is a type of object that you can use to derive other.

    Suppose you want to categorize animals; you can start by defining a class "animal", which can be used thereafter as a template for other class like "bird",  "fish", "insect" etc. 

    Deriving them prevents you from having to redefine everything that is common in all "animal", you only need to add what is *specific* in "bird", "mollusk" and so on.

    The class is some kind of container that groups properties (values) and methods (functions) that are specific for that kind of object.

    • ...Show all comments
    • Snezzy
      Lv 7
      2 months agoReport

      In my opinion some languages provide multiple inheritance to make it easier to shoot ourselves in our feet.

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.