package pro2; class Person { String name; Person(String name) { this.name = name; System.out.println(name); } } class Employee extends Person { int Employeeid;
Employee() { super("Default Name"); System.out.println("test"); } void display() { System.out.println("Detail of employee"); } } public class Mainclass2 { public static void main(String[] args) { // Person p1 = new Person("vijay"); Employee e1 = new Employee(); e1.display(); } }
brother please next vidoes seekiram upload pannunga naa unga video kaka tha rompa naal wait panne inheritance ku aprm en class la nadathurathu suthama puriyala ippo exams vachutanga java la naa unga videos sa nambi tha irukke
Bro one doubt you're creating object for class Employee and passing args as John, now here is the confusion starts for me,now the John parameter will straightly assigned in super(name(John)); like this, or the John parameter will be assigned in Employee (String name(John)) and further it goes to super ? If the the employee object directly assign its parameter (John) to super (name(John)) then what will be the value of Employee class constructor Employee (String name(?)). Please reply for this comment,if anyone knows please do reply for this comment Thank you
The name property belongs to the Person class, the Employee constructor receives the name and passes it to super class property name. Assume that the Employee class also has a property called name, then in the constructor of Employee, you code like super(name); this.name=name; This means the name property is first assigned to Employee then passed to Person
I have one doubt....Why we have to use super.makesound()? We had already used d1.makesound() this also does the same.🤔.Pls reply me whether I'm correct or not?
Bro enaku 1st code laye error varudhu I mean Animal and Dog code laye error varudhu but na crt ah than code potten error: can't find (String []) method in class :Animal epdi varudhu
The inheritance type in this code is multilevel inheritance and hierarchical inheritance
Waiting for all other videos bro❤
Coming soon
package pro2;
class Person {
String name;
Person(String name) {
this.name = name;
System.out.println(name);
}
}
class Employee extends Person {
int Employeeid;
Employee() {
super("Default Name");
System.out.println("test");
}
void display() {
System.out.println("Detail of employee");
}
}
public class Mainclass2 {
public static void main(String[] args) {
// Person p1 = new Person("vijay");
Employee e1 = new Employee();
e1.display();
}
}
brother please next vidoes seekiram upload pannunga naa unga video kaka tha rompa naal wait panne inheritance ku aprm en class la nadathurathu suthama puriyala ippo exams vachutanga java la naa unga videos sa nambi tha irukke
Director "PARTHIBAN " VOICE
Hi bro core java one video podunga bro
c++ video podunga bro
while inheriting parent class(Person) from child class (Employee) how many objects would be created in the heap?
One object, that contains both Person and Employee fields (member variables)
Upload videos often dude
Bro one doubt you're creating object for class Employee and passing args as John, now here is the confusion starts for me,now the John parameter will straightly assigned in super(name(John)); like this, or the John parameter will be assigned in Employee (String name(John)) and further it goes to super ?
If the the employee object directly assign its parameter (John) to super (name(John)) then what will be the value of Employee class constructor Employee (String name(?)).
Please reply for this comment,if anyone knows please do reply for this comment
Thank you
Yes, 2nd one.. the John parameter will be assigned in Employee (String name(John)) and further it goes to super
The name property belongs to the Person class, the Employee constructor receives the name and passes it to super class property name.
Assume that the Employee class also has a property called name, then in the constructor of Employee, you code like
super(name);
this.name=name;
This means the name property is first assigned to Employee then passed to Person
I have one doubt....Why we have to use super.makesound()? We had already used d1.makesound() this also does the same.🤔.Pls reply me whether I'm correct or not?
Yes bro you can
❤❤
Bro next video poduga please
Hi
Bro enaku 1st code laye error varudhu I mean Animal and Dog code laye error varudhu but na crt ah than code potten
error: can't find (String []) method in class :Animal epdi varudhu
Same error I faced😢 for past one week
Bro main class ahh first la potuga error clear akirum
Main Ilene , programku enge start pannumnu theriyathu
Program main function la dhan execution start agum so that main function entha clss la iruko atha name la save pannanum
Elarum indha run pani pathinagala enaku varala ungaluku?