Sum of Digits in C Programming

Program to calculate sum of digits in C of a number using loop, explained logic and test cases. Example, Input number: 123 Output = 1+2+3 =6 Logic to find sum of digits: Have two variables” sum” and “remainder” with initial value 0. loop through the number Get remainder of the number with modulus 10. e.g.…

Read the full article

Multiple Inheritance in Java

Learn multiple inheritance in java using interface with example programs – Multiple inheritance  can be implemented using interfaces not classes. Note that java does not support multiple inheritance using classes. But, we can achieve it using interfaces. In other words, in Java, a class can extend only one class but can implement multiple interfaces. Recommended…

Read the full article

Hybrid Inheritance In Java

Hybrid inheritance in java with example and simple program – In hybrid inheritance, we use mixed of different types of inheritance relationship in java program. For example, we can mix multilevel and hierarchical inheritance etc. Prerequisite: Inheritance introduction in java Before reading Hybrid inheritance in java language, you can read following different types of inheritance.…

Read the full article

Hierarchical Inheritance in Java

Learn Hierarchical Inheritance in java with example – When more than one classes inherit the same class is known as hierarchical inheritance. Prerequisite: Java Inheritance Consider a Hierarchical Inheritance example, A Teacher is expertise in the subjects java programming, physics and chemistry. So, The two departments i.e. computer department and science department can use the…

Read the full article

Multilevel inheritance in Java

Learn Multilevel inheritance in java oops with  code example – In Multilevel inheritance, a class is derived from another class which is also derived from some another class … For example class C extends class B and class B extends class A then this type of inheritance in java language is known as multilevel inheritance.…

Read the full article

Inheritance in java with example

Learn inheritance in Java with simple example and easy steps. Types of inheritance and advantage of using inheritance is explained. Inheritance in Java Inheritance is one of basic oops principles in java. In inheritance relationship, a class can access fields and methods of an existing class. Existing class is known a as base class or…

Read the full article

Object Initialization in Java Through Constructor

Learn how to initialize an object of a class in java  through constructor with simple example and source code. what will you learn? What is object initialization? How to initialize an object and why? Object initialization by hard code value in constructor Object initialization by constructor parameter Prerequisite: You need to be familiar with below…

Read the full article