Aggregation vs Composition vs AssociationAggregation vs Composition vs Association

0 Comments

Aggregation:It represents a Has-A relation. Its a one way relationship which means that a departments can have multiple students but a student cant belong to multiple departments.Also in aggregation both the entities can exists independently which means that they are not dependent on each other, ending one entity will not


Polymorphism in JavaPolymorphism in Java

0 Comments

Polymorphism mean the condition of occurring in several different formsPolymorphism in Java has two types: Compile time polymorphism (static binding) and Runtime polymorphism (dynamic binding). Method overloading is an example of static polymorphism, while method overriding is an example of dynamic polymorphism. Polymorphism represents a IS-A relationship Consider a class


Interface in JavaInterface in Java

0 Comments

Interface in java is a model/prototype of a class. It has static constants and methods (without implementation). There can be only abstract methods in the java interface not method body. It is used to achieve abstraction and multiple inheritance in Java. It cannot be instantiated. Three reasons to use interface. They


How to print in Pyramid of Numbers in Java?How to print in Pyramid of Numbers in Java?

0 Comments

Below programs display the pyramid of numbers based on user input // Library to import import java.util.Scanner; Scanner input = new Scanner (System.in); // for taking input from user System.out.println("Enter the Input Number that how many times do you want to get pyramid of numbers : "); int inputNumber =


How to count characters from a set of variables in Java?How to count characters from a set of variables in Java?

0 Comments

In the below code, I generate a set or array of random variables and then I am counting every individual character so in through this program we can identify the occurrence of each character. To generate Random numbers we will use a random library of Java to generate random alphabets


Implement Caesar Cipher in Java?Implement Caesar Cipher in Java?

0 Comments

In cryptography, a Caesar cipher, also known as Caesar’s cipher, the shift cipher, Caesar’s code or Caesar shift, is one of the simplest and most widely known encryption techniques. Lets implement this; //First we take input of word Scanner input = new Scanner (System.in); System.out.println("Enter Word"); String word=input.nextLine(); //Then we take input for steps  or we can say that