OK as you can see here these are the components inside the screen.
OK.
So hopefully that makes sense.
Let's actually double click on this content underline that example and just select the spots in here.
So just select is a button here.
And now let's actually find the layout here and we can try to change this value.
This Arap content value to match palette.
OK.
Now as you can see here David of disputant actually covers the entire screen.
OK the entire width of the screen.
OK.
But the wrap content attribute actually wraps this button around its contents.
OK.
Laps the width of this button around its content.
So let's actually change this value to match parent.
So hopefully that makes sense.
Let's actually go inside this main activity that Java here and here we can actually put our own codes
here.
So as you can see here we need to actually free different classes here.
A class called vehicle or class called car and a class called motorcycle OK.
So let's actually create these free classes.
OK.
Now we want to actually create free different classes.
So let's actually click on View tool windows and then click on Project.
So here just click on this package here as you can see and then click on File New and then click on
Java class.
OK.
So for the name of the class just type in here vehicle K..
And now let's actually create another class called card.
So just click on this package here find new jobs class.
OK.
Car as you can see here are car class is created again we need to actually create another class called
motor cycle.
So just click on this package here.
File New.
And then click on Jobar class motor cycle.
OK.
So this is our motorcycle class.
OK.
So let's actually work on this vehicle class here.
This class is going to be the superior class for these two classes for this motorcycle class and for
the car class as you know the car is actually a vehicle and a motorcycle is actually again a vehicle.
OK.
So let's first work on this.
Plus here first of all I want to actually put in some instance variables that are related to this vehicle
class.
OK.
Now we need to actually specify the instance variables that are related to these very vehicle class.
OK.
So the first instance variable is going to be the speed.
OK.
So first we need to actually specify the access modifier of this instance variable private's and the
data type of this instance variable is eans and the name of this instance variable is speed.
OK.
Private and all vehicles have a braking system.
OK.
So I can just create a boolean variable has braking
and because we are sure that all vehicles have a braking system we can actually make this variable a
constant.
OK so private fine on Boullion has braking system.
All vehicles have vehicles.
OK.
So private int and the name of this instance variable is the number of vehicles.
OK so now let's actually create a constructor for this vehicle class.
So first of all I need to actually specify the access modifier of the constructor and the name of this
constructor must be the same as the name of this class vehicle.
OK.
And then I need to actually put in a pair of round brackets after my constructor name and then I need
to open and close my constructed by using these curly braces.
So inside these Apprentice's I can actually specify some arguments the data type of the first argument
is int and the name of this argument is speed comma and the data type of the second argument is boolean
and the name of this argument is has braking system comma and the name of this first instance variable
is number of years and it is of type int.
So first I need to actually specify the data type of this argument and the name of this argument is
number of years.
OK.
So inside this constructor First we need to actually specify that the constructor of the superclass
is initialized.
So as you know this vehicle class is implicitly inheriting all of the features and behaviors that are
inside the object class and because inside the object class you have actually a default constructor
we have a constructor without no parameters.
The compiler is going to actually implicitly initialize that constructor for us.
OK we can explicitly initialized as constructed by just typing here super.
OK but if you don't put this a line of code here.
The compiler is going to actually initialize the constructor of the superclass automatically for us.
OK so we don't need to actually initialize that constructor only to actually initialize my own instance
variables inside this constructor.
So this does speed assignment operator speed.
Semicolon this that has braking system assignment operator has Brahim system and this dot number of
Veals assignments operator number of wheels.
OK so hopefully that makes sense.
And now let's actually create setters and getters for these instance variables.
So inside this vehicle class and outside of these constructed just right click here and then click on
generate and then we can get her and set her Sahir select all of these instance variables and then click
on OK these getters and setters are actually created automatically for us.
Get speed set speed.
Is has braking system get number of visas and set number of wheels.
So let's actually delete this is here and just put in the word get here.
Get has braking system and then let's actually create an instance Smurfette for this vehicle class so
we can actually create a method called right.
OK Puplick void.
Right OK.
And then I put in a pair of round brackets after my Meffert name and then I open and close the Smurfette
by using these curly braces.
So here we can actually put in our own quotes.
OK so make sure that inside of your own class to choose the getters and setters in order to access the
value of this instance variables.
OK in this way your quotes are going to be more maintainable and it is more secure.
So now I want to actually produce an integer value.
So end result.
Assignment operator.
And then I can actually multiply the value of this speed instance variable by the value of this number
of violists OK so I can't just refer to the good term if it gets speed multiplied by jets number of
wheels.
OK so in this way you are actually referring to these guitars in order to access the value of this instance
variables.
OK this is a better way.
In order to actually this the value of your instance variables always use getters or stars in order
to manipulate the value of these instance variables.
OK.
And now I can actually create another instance variable here.
For example private int and the name of this instance variable is the right speed.
OK.
And then I put in an assignment operator here.
I actually put in a semicolon here.
OK.
So as you can see here now we can actually assign the value of this result local variable.
So remember this result variable is actually a local variable because it is local to this method only
OK.
We cannot refer to this method from anywhere inside this class.
OK.
We can actually refer to this variable only inside this method.
So now I can actually refer to the name of the write speed instance variable assignment operator result.
So hopefully that makes sense.
Let's actually only create a I'll get my head for this right speed instance variable just right here
inside this vehicle class and then they can generate getter OK.
I just want to create a getter for this right.
Speed instance variable.
OK.
And then click on OK.
So as you can see here now we have a getter method for this right speed instance variable.
We can actually access the value of this right speed instance variable by using this method.
OK.
Get right speed.
So hopefully that makes sense.