In this video lecture I'm good at tissue how to use a spot class and inheritance in Java programming.
Okay I've thought about multiple inheritance in Java in the previous lecture.
So let's go ahead and look at how to use a superclass in inheritance.
So go ahead and start off by creating a class and let the class name be just the one we did previously.
Student
okay.
And let's call it some string on string.
String
forced me and string last name.
And let's go ahead and create another constructor.
And this constructor is going to be students
or string
string.
This code is f name and for the first name and string l name for the last name
then go ahead.
I say first name C quote so f name and our this is first name first name and last name.
C quote so l name then.
Now you go ahead and create and cause another class.
Lectures won't extend three class students.
And just like we did previously.
Let's call that class school
explains student
all right.
Class school extends student.
And let's go ahead.
And C
let's quit so variable like say I D grade students great on the string subject.
Okay.
So say at constructor All right we are coming.
So go ahead and there is critical struggle for these school and this takes a string f name for the first
name of the student and the string
string l name one last note the student.
And integrate and the string
thank you.
Let's go this SOP for a subject
key so let's check wide area.
Easier said implicit super constructor student is on defined student use on defined.
Let's continue.
We are going to solve this problem as you move ahead.
So let's go ahead and create super appointees to student and let us go ahead and take f name
and our name
semicolon at the end and the next thing that we need e the Creed
well is that my grade.
So my grade is equal to we need to change this to it.
Less changes to be it as we have grade already defined with it.
Let us go ahead and we interest call.
All right.
So great is your quote source code for a semicolon an end and subject
is set to sop.
Put a semicolon at the end.
So now we've done justice to that.
Let's go ahead and create a public coherent grits.
Public static void me and led ne of police to avoid I had a very strong axe
so for the first time I'm going to critique construct old school
let us call it a b c hash is equal to a new school.
And this is going to take for the fostering is going to be the name of the student and a name of the
student is going to be David
Okay.
Put a semicolon.
The last name the first notice student is David v and the last name is gonna be Jacob.
So David Jacob and the next one is going to be this cow of the student.
So let this cow be night eat and the next one is going to be the subject and the subject is going to
be Java.
I don't think of Java as a subject.
All right let's continue and this is change construct to this to be String String String
okay.
So remove these.
God is an integer value so snugly to be a string and problem is solved because we have integer it's
core at this point.
All right let's go ahead and bring this out okay.
So come over here and I'm going to see sustained not outs while that is out system out that's print
Lane
Look at that print line and that is going to be let's say
pray it should be in a string format
studies
the name e
so for us to get a first name you see page C hash that's first name I will print out the first name
for us.
So this is system should be an upper case then for the last name.
Go ahead
system the out thought print line and this is
today's last name is
C hash.
That's last name.
Then if you want to get the subject's disco system that out that's print line.
This is through Dan
creed
things.
Greed is conquered myths.
That's Creech and the same thing.
System not out that's print line.
Student
subject is
soon subject easy hash.
That's
subject.
So now go ahead and configurations.
And this is project one which seeks heat up a such for a man class super inheritance upkeep.
Apply this code Rose student's first name is David.
Why is this chicken so strange first name is David said his last name is Jack.
Studies grid is made it and students subject is Java.
All right I hope that is making sense.
So why not put it down.
And if you have any question on that video lecture please try to use the question and answer section
and I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.