Java OOPs

What are the principle concepts of OOPS? There are four principle concepts upon which object oriented design and programming rest. They are: Abstraction Polymorphism Inheritance Encapsulation (i.e. easily remembered as A-PIE). What is Abstraction? Abstraction refers to the act of representing essential features without including the background details or explanations. What is Encapsulation? Encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate. It prevents other objects from directly altering or accessing the properties or methods of the encapsulated object. What is the difference between abstraction and encapsulation? Abstraction focuses on the outside view of an object (i.e. the interface) Encapsulation (information hiding) prevents clients from seeing it’s inside view, where the behavior of the abstraction is implemented. Abstraction solves the problem in the design side while Encapsulation is the Implementation. Encapsulation is the deliverables of Abstraction. Encapsulation barely… Read more“Java OOPs”

Basic Java constructs

Java is a strongly typed language, which means that all variables must first be declared before they can be used. The basic form of variable declaration is “Variable Type followed by variable name”. For example “int myVar;” Doing so tells your program that the variable named “myVar” exists and holds numerical data[ i.e integer value]. A variable’s data type determines the values it may contain, plus the operations that may be performed on it. The data types are of two types. They are primitive data types and reference data types. Primitive Data Types are pre defined by the language and is named by a reserved keyword. Example: int, float etc. Reference Data types are often referred as non-primitive data types. Example: Objects and Arrays They are called as reference data types because they are handled “by reference” – in other words, the address of the object or array is stored in… Read more“Basic Java constructs”