I was not in touch with all of you for a long time because i was preparing for Imagine Cup (The world's premiere student technology competition from Microsoft) whose finals will be held at Egypt.
There are competition categories from Software Design, Game Development, IT Challenge, Design, Photoraphy and many more...
I am sure all of you have registered for the same. If not then immediately visit http://imaginecup.com/ We might meet at Egypt for the finals.
Today I will be discussing some important questions about Java which might help you during your Job interview.
Q. What are the three OOPS principles?
Ans: Encapsulation, Inheritance and Polymorphism are the three OOPS Principles.
- Encapsulation: It is the Mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.
- Inheritance: It is the process by which one object acquires the properties of another object.
- Polymorphism: It is a feature that allows one interface to be used for a general class of actions.
Q. What are the advantages of inheritance?
Ans: Reusability of code and accessibility of variables and methods of the superclass by subclasses.
Q. What is meant by variable? What are the kinds of variables in Java?
Ans: Variables are locations in memory that can hold values. Before assigning any value to a variable, it must be declared. Java has three kinds of variables namely, the instance variable, the local variable and the class variable.
Local variables are used inside blocks as counters or in methods as temporary variables and are used to store information needed by a single method. Instance variables are used to define attributes or the state of a particular object and are used to store information needed by multiple methods in the objects.Class variables are global to a class and to all the instances of the class and are useful for communicating between different objects of all the same class or keeping track of global states.
Q. What is mean by Garbage Collection?
Ans: When an object is no longer referred to by any variable, Java automatically reclaims memory used by that object. This is known as garbage collection.
Q. What is interface? What is use of interface?
Ans: It is similar to class which may contain method’s signature only but not bodies. Methods declared in interface are abstract methods. We can implement many interfaces on a class which support the multiple inheritance.
Q. Can we define a variable in an interface ?and what type it should be ?
Ans: Yes we can define a variable in an interface. They are implicitly final and static.
I will covering some more important Q&A in my coming interactions.
Happy Learning!!...
Cheers
Padhaku Einstein
Contact me at einstein.padhaku@gmail.com