Part 2
6 : What is the divergence betwixt static together with non static variable?
Answer : Main differences are every bit bellow.
- Static variables are preceded yesteryear static keyword. For non-static variable, at that topographic point is non whatever preceding keyword.
- Memory is allocated for static variables at the fourth dimension of shape loading. Memory is allocated to non- static variables whenever an object is created.
- Memory is allocated alone in 1 lawsuit to static variables on shape loading. Memory is allocated multiple fourth dimension whenever a novel object is created to non-static variables.
- Static variable representative : Collage advert of students, Company advert of employees..
READ MORE almost static together with non-static stuff.
7 : What is the divergence betwixt static together with non static(Instance) method?
Answer : Difference betwixt static together with non static method is every bit bellow.
- Method declared amongst static keyword is static method. If Method declared without static keyword hence it is instance method.
- No necessitate of object to telephone cry upward static methods. Object needed to call instance method.
- Can non access non static materials within static methods directly. Opposite to it, We tin access static together with non static materials straight inside instance method.
8 : What is inheritance inward java?
Answer : In Java, Inheritance provides machinery using which 1 object of child shape tin start out all the properties together with behaviors of rear object. It volition crate IS-A relationship. Main usage of inheritance inward coffee is for code re-usability together with method overriding to gain run-time polymorphism. VIEW MORE special on inheritance.
9 : Multiple inheritance is supported inward coffee on shape level? If No.. Why?
Answer : No.. Multiple inheritance is non supported inward coffee inward representative of shape to simplify the linguistic communication together with trim down the complexity.
10 : What is method overriding inward java?
Answer : Method overriding is a characteristic which allows a child shape or sub shape to supply a specific implementation of a method which is already provided yesteryear 1 of its rear classes or super class. It is used for runtime polymorphism. You tin read to a greater extent than almost method overriding on THIS POST.