The major use of abstract classes and methods is to achieve abstraction in Java. Abstraction is an important concept of object-oriented programming that allows us to hide unnecessary details and only show the needed information. This allows us to manage complexity by omitting or hiding details with a simpler, higher-level idea. A practical example ofContinue reading “JAVA ABSTRACTION”
Category Archives: Uncategorized
DYNAMIC BINDING
“Dynamic” means “run time” and “binding” means “association”. Method Overriding is a perfect example of dynamic binding as in overriding both parent and child classes have same method and in this case the type of the object determines which method is to be executed. The type of object is determined at the run time so this is known as dynamicContinue reading “DYNAMIC BINDING”
Types of Inheritance In Java
Types of inheritance: On the basis of class, there can be three types of inheritance in java: single, multilevel and hierarchical. Single Inheritance: When a class inherits another class, it is known as a single inheritance. Sample Program: CLASS A PROGRAM: package x.ab;public class A{public static void main(String[]args){}public void methodA(){System.out.println(“Base Class Method”); }} CLASS B PROGRAM:Continue reading “Types of Inheritance In Java”
INHERITANCE
An object of one class behaving as an Object of Another Class. The idea behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields inContinue reading “INHERITANCE”
Java Access Modifiers/Specifiers :
An access modifier restricts the access of a class, constructor, data member and method in another class. In java we have four access modifiers:1. Default2. Private3. Protected4. Public Default Access Modifier: Default Access Modifier is otherwise called as Package Level Access Modifier. If you don’t use any modifier, it is treated as default by default. The defaultContinue reading “Java Access Modifiers/Specifiers :”
WHAT IS CONSTRUCTOR IN JAVA
We create a constructor to initialize an object. They have the same name as the class but have no explicit return type. It can be used to set initial values for object attributes. It is similar to a Java method At the time of calling the constructor, the memory is allocated for the object. EachContinue reading “WHAT IS CONSTRUCTOR IN JAVA”
SUB-PACKAGE IN JAVA
WHAT IS SUB-PACKAGE IN JAVA: Package inside the package is called the sub package The packages that come lower in the naming hierarchy are called “sub package“. Constructor In Java: A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. Unlike Java methods,Continue reading “SUB-PACKAGE IN JAVA”
PRIVATE ACCESS MODIFIER
In Private Access Modifier, Visible inside the same Class Only. More Restrictive Access Modifier. The scope of private modifier is limited to the class only. Private Data members and methods are only accessible within the class Class and Interface cannot be declared as private If a class has private constructor then you cannot create the object ofContinue reading “PRIVATE ACCESS MODIFIER”
DRY CONCEPT IN JAVA
DRY means DON’T REPEAT YOURSELF: A basic principle of software development aimed at reducing repetition of information. The DRY principle is stated as, “Every piece of knowledge or logic must have a single, unambiguous representation within a system.” NOTE:“In String Concept,only for Sring Class.We Can Create Objects or References Without Using New Keyword“ Code Reusability: As theContinue reading “DRY CONCEPT IN JAVA”
OBJECT ORIENTED PROGRAMMING
Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function. OOPs Concepts: Object: Object is State and Behaviour.Continue reading “OBJECT ORIENTED PROGRAMMING”