answersLogoWhite

0

A class is like a template. You can define a class "Person", which defines what type of data you want to store for a person - for example, for a computer game, the person's name his accumulated score, and how many lives he has left. The class might better be called "Player" in this case - but you can just as well store other data for a Person.

Then, you create objects for two different players. You declare variables player1 and player2, both of type "Person". It is in these variables - player1 and player2 - where you store specific information about individual persons.

A class is like a template. You can define a class "Person", which defines what type of data you want to store for a person - for example, for a computer game, the person's name his accumulated score, and how many lives he has left. The class might better be called "Player" in this case - but you can just as well store other data for a Person.

Then, you create objects for two different players. You declare variables player1 and player2, both of type "Person". It is in these variables - player1 and player2 - where you store specific information about individual persons.

A class is like a template. You can define a class "Person", which defines what type of data you want to store for a person - for example, for a computer game, the person's name his accumulated score, and how many lives he has left. The class might better be called "Player" in this case - but you can just as well store other data for a Person.

Then, you create objects for two different players. You declare variables player1 and player2, both of type "Person". It is in these variables - player1 and player2 - where you store specific information about individual persons.

A class is like a template. You can define a class "Person", which defines what type of data you want to store for a person - for example, for a computer game, the person's name his accumulated score, and how many lives he has left. The class might better be called "Player" in this case - but you can just as well store other data for a Person.

Then, you create objects for two different players. You declare variables player1 and player2, both of type "Person". It is in these variables - player1 and player2 - where you store specific information about individual persons.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

What is use of dot operator in java?

"the dot" connects classes and objects to members. The places where you use it in what I cover are:(1) when you are connecting an object reference variable to a method. The Extending Existing Classes lesson introduces the dot operator for this use, and(2) when you are connecting a class name to one of its static fields. An example of this is the dot between "System" and "out" in the statements we use to print stuff to the console window. System is the name of a class included in every Java implementation. It has an object reference variable that points to a PrintStream object for the console. So, "System.out.println( "text") invokes the println() method of the System.out object.


How many data types can the elements of an array have?

Depends on your language. Assuming java: If you make it an Object[] then it can contain any object For primitive types you must either make a primitive type array, ie double[], char[] which can contain only those primitives, or creater an Object[] and use primitive wrapper objects ie java.lang.Integer etc.


How do you use delete function in inheritence in classes using c plus plus?

You use delete to release the memory occupied by an object that is being pointed to by the pointer you delete. Provided all base classes have a virtual destructor, it doesn't matter what the type of pointer you actually delete is, so long as it is a type of class from which the object is actually derived. The destructor from the most-inherited class (the object itself) will be called first, which calls the destructors of its immediate base classes, and theirs, and so on until the object is completely released from memory.Note that you must not delete pointers to object references -- they must be nullified (not deleted) when they are no longer required. The referenced object will be deleted automatically when it falls from scope.


Compare anonymous class with abstract class?

Abstract Classes contain the work abstract in it. It is used when you know that you will need to use an object of its type but do not know the inner workings yet. Anonymous classes are those classes that are constructed on the fly. You need to know its inner workings.


What class is the super class for ALL Java classes?

The Object class, in the java.lang package, sits at the top of the class hierarchy tree. Every class is a descendant, direct or indirect, of the Object class. Every class you use or write inherits the instance methods of Object. You need not use any of these methods, but, if you choose to do so, you may need to override them with code that is specific to your class

Related Questions

How do you use him and her in a sentence?

Example sentence - I wanted him to see for himself her answers were fabricated.


What object does Juliet use as an example of unimportance of names in romeo and Juliet?

what object does juliet use an example of unimportance of names


What is the correct grammar for i and me?

Use "I" when you are referring to the subject of a sentence, and use "me" when you are referring to the object. For example, "I am going to the store" (subject) and "She gave the book to me" (object).


What is the proper way to use me in a sentence?

The word 'me' is a pronoun that is used as the object of a sentence or phrase; the first person objective used in place of your name. Example: That book belongs to me.


What is use of dot operator in java?

"the dot" connects classes and objects to members. The places where you use it in what I cover are:(1) when you are connecting an object reference variable to a method. The Extending Existing Classes lesson introduces the dot operator for this use, and(2) when you are connecting a class name to one of its static fields. An example of this is the dot between "System" and "out" in the statements we use to print stuff to the console window. System is the name of a class included in every Java implementation. It has an object reference variable that points to a PrintStream object for the console. So, "System.out.println( "text") invokes the println() method of the System.out object.


Is the word classes an object?

Classes is the plural of the word class. A class is not an object in the physical sense, it is an idea, a notion or concept. We typically use a class to define a classification, such as a class of people, a class of study or a class of object. In other words it defines a type.


When can you use me and you in a sentence?

The pronouns 'me' and 'you' are used as the object of a sentence or phrase. (note: it's always more polite to put the word 'you' first before 'me') Example sentence: This trip will be a great experience for you and me.


Where can I take free typing classes online?

There Are alot of Websites that offer Free typing classes. For example you can use: www.goodtyping.com/, www.typingweb.com/, orwww.freetypinggame.net/


How do you find the deinsity of an object?

For example, you can use the definition of "density", and just divide the object's mass by its volume.


When do you use the pronoun I or me?

The pronoun "I" is a subject pronoun, a word that takes the place of a noun (name) for the person speaking as the subject of a sentence or a clause. Examples:I like this movie. (subject of the sentence)This is the movie that I like. (subject of the relative clause)The pronoun "me" is an object pronoun, a word that takes the place of the noun (name) for the person speaking as the object of a verb or a preposition. Examples:Sandra invited me to her party. (direct object)Grandma made me some cookies. (indirect object)Jim is going to the mall with me. (object of the preposition)


How do you use their and there?

Their is used if you are talking about another person's object. For example: "Have you given their ball back yet?" and "What did you do at their house?" For 'there' it's more about location. For example: "How long before we get there?" or "Are there any more ice-creams left in the freezer?"


What defines the behavior of an object in object-oriented programming and how is it implemented within the programming paradigm?

In object-oriented programming, the behavior of an object is defined by its methods, which are functions that describe what the object can do. This behavior is implemented by creating classes that define the structure and behavior of objects, and then creating instances of those classes to use in the program. The methods within the class determine how the object interacts with other objects and data in the program.