what is expected, i can't understand and where it is expected?
how to do this?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
horst
19 December 2019, 10:03
Dear Rani,
at first, I found the jump from declaring "simple" variables (i.e. primitive data types) to declaring complex ones kind of abrupt, too. So here's some general info on what you are actually doing there:
You create a class called Cat, which means you create a complex data type called Cat that can store multiple different data types. Think of it like a container for a set of data that you specified. (in our case maybe a String for the name, an integer for the age and so on.)
Now you can actually use this new data type in your main method just like the standard ones, which means: you declare it by stating its type and giving it a name;
The syntax is a little different, but the idea is the same:
Declaration of a primitive type:
(you see: first the type, then the name of the variable and finally the content)
Declaration of a complex type:
(first the type - which we created by our own hands! - then the name and finally the content)
Note that now our freshly created object has all the basic properties we specified (name, age, ...) and you will learn later on how to fill these properties with actual values (e.g. a three year old cat called Whiskers)
+1
Artem Divertitto Senior Android Developer at United Tech
19 December 2019, 08:57
If you didn't read lecture, you have better do it.
In this task you must create three variable inside Person class.
And then in main method create instance of Person class, for example:
0