Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Java program on rodent hierarchy

Categories: Inheritance. No Comments on Java program on rodent hierarchy

In this article we will learn to implement a Java program on rodent hierarchy. A Java program is provided below which uses the rodent hierarchy to demonstrate inheritance in Java.   Java program to create an inheritance hierarchy of Rodent, Mouse, Gerbil, Hamster etc. In the base class provide methods that are common to all Rodents […]

Read the rest of this entry »

Java program on shape hierarchy

Categories: Inheritance. No Comments on Java program on shape hierarchy

In this article we will learn to implement a Java program on shape hierarchy. The requirements for writing the program is specified below.   Java program to create an abstract class named Shape that contains an empty method named numberOfSides( ).Provide three classes named Trapezoid, Triangle and Hexagon such that each one of the classes […]

Read the rest of this entry »

Java program that illustrates how runtime polymorphism is achieved

Categories: Inheritance. No Comments on Java program that illustrates how runtime polymorphism is achieved

In this article we will learn to implement a Java program that illustrates how runtime polymorphism is achieved. A Java program is provided below that demonstrates how runtime polymorphism is achieved. abstract class Figure { int dim1, dim2; Figure(int x, int y) { dim1 = x; dim2 = y; } abstract void area(); } class […]

Read the rest of this entry »

Java program for sorting a given list of names in ascending order

Categories: Strings. No Comments on Java program for sorting a given list of names in ascending order

In this article we will learn to implement a Java program for sorting a given list of names in ascending order. A Java program is provided for sorting a given list of names or strings in ascending order.   Program is as follows: import java.util.*; class Sorting { void sortStrings() { Scanner s = new […]

Read the rest of this entry »

Java program that checks whether a given string is a palindrome or not

Categories: Strings. 1 Comment on Java program that checks whether a given string is a palindrome or not

In this article we will learn to implement a Java program that checks whether a given string is a palindrome or not. A Java program is provided below that reads a string, checks whether it is a palindrome or not.   Program is as follows: import java.util.*; class Palindrome { void isPalindrome(String str) { String […]

Read the rest of this entry »

Java program for matrix multiplication and matrix transpose

Categories: Arrays. No Comments on Java program for matrix multiplication and matrix transpose

In this article we will learn to implement a Java program for matrix multiplication and matrix transpose. A Java program is provided below to check the compatibility for multiplication, if compatible, multiplies two matrices and also finds its transpose. import java.util.Scanner; class Matrix { void matrixMul(int m, int n, int p, int q) { int[][] […]

Read the rest of this entry »

Java program to print the nth element in the Fibonacci series

Categories: Basic. No Comments on Java program to print the nth element in the Fibonacci series

In this article we will learn to implement a Java program to print the nth element in the Fibonacci series. A Java program is provided below to print the nth element in the Fibonacci series using both non-recursive and recursive methods.   Program is as follows: import java.util.*; class Fibonnaci { int nFib(int n) { […]

Read the rest of this entry »

C program to demonstrate how to use a typedef struct in c

Categories: Structures and Unions. No Comments on C program to demonstrate how to use a typedef struct in c

In this article we will learn to implement a C program to demonstrate how to use a typedef struct in c. A C program is provided below which illustrates how to use typedef along with a structure.   Program is as follows: /* * C program to demonstrate typedef usage with a structure * Author: […]

Read the rest of this entry »