Gopinath Sundaram
Gopinath Sundaram answered question
Object is an instance of a class.It has state,behaviour and identity.There are no types of objects.For the object to be created,the class of the object should be created with needed constructors and then creation of object is done by : Classname objectname = new classname()(depends on which constructor we use).
Gopinath Sundaram
Gopinath Sundaram answered question
Encapsulation is hiding of implementation details.Let me tell you an example for your second question : Consider a house without walls,Is it safe - No,it isn't.For safety and protection,we built walls on both sides(encapsulation is there).But,now the house is surrounded by only walls,what is the use?? So,you keep a door,thus making the house usable(Abstraction+Encapsulation).Abstraction is … Read more
Gopinath Sundaram
Gopinath Sundaram answered
Interfaces is one of the best used concepts in Java.let me explain this with an example : Say you designed a gps device for car which looks into the map and automatically turns the car to the direction as seen in the map.This GPS device can be used in many cars like benz,fiat,etc.For each car,the … Read more
Gopinath Sundaram
Gopinath Sundaram answered
Preprocessor is the phase which comes before compiling(Pre-before).This phase takes care of macro substitution,etc.Inline function is the expansion of function calls there itself by the compiler to prevent function overhead for small functions(by using the keyword inline(c++) the function is made inline).However,the compiler decides whether the functions is expanded or not based on certain conditions … Read more