Found 7442 Articles for Java

Java Program to Calculate Interest for FDs and RDs using Inheritance

Shriansh Kumar
Updated on 06-Jun-2025 14:04:57

870 Views

Inheritance is a concept that allows us to access the properties and behaviors of one class in another class. The class whose methods and member variables are inherited is known as the super class or parent class, and the class that inherits these methods and member variables is known as the child class or subclass. In Java, we use the extends keyword to inherit a class. Problem Statement Write Java programs that calculate interest for Fixed Deposits (FDs) and Recurring Deposits (RDs) using inheritance. The program should prompt the user to choose between FD and RD, enter the amount and duration, ... Read More

Java Program to Calculate difference between two Time Periods

Shriansh Kumar
Updated on 19-Jun-2025 10:19:22

823 Views

We are given two time periods, and our task is to write a Java program to calculate the difference between them. For this problem, we can use classes and methods of java.time, java.util, and java.text packages. SimpleDateFormat class Date class LocalDate class Period class parse() method between() method As we move further in this article, we will understand the uses of these classes and methods in calculating the difference between two time periods. Some examples ... Read More

Java Program to Calculate Sum of Two Byte Values Using Type Casting

Shriansh Kumar
Updated on 19-Jun-2025 15:38:06

525 Views

When we convert a data type to another data type, we call it type casting. There are two types of type casting in Java: explicit and implicit. Explicit Type Casting  When we typecast a one datatype to another using the cast operator "()",  it is known as explicit type casting, and it is done manually. We typically use the cast operator to convert a higher datatype to a lower datatype. Therefore, there is a risk of losing data because a lower datatype has a range smaller than a higher datatype. Implicit Type Casting But, to convert a smaller datatype to a larger one, ... Read More

Java Program to Categorize Taller, Dwarf and Average by Height of a Person

Shriansh Kumar
Updated on 30-May-2025 16:22:30

498 Views

The given task is to categorize Taller, Dwarf, and Average by the Height of a Person. First of all, we need to define tall, dwarf, and average height of a person. Let us assume -A person with a height between 170cm to 195cm is considered taller.If his height is between 150cm and 195cm, he is considered taller.A person whose height is below 150cm is considered a dwarf.If his height is greater than 195cm, he is considered abnormal.Categorizing the Height of a Person in JavaTo categorize the Height of a Person, we need to compare his height with each range specified above. ... Read More

Java Program to Add Characters to a String

Shriansh Kumar
Updated on 30-May-2025 17:54:49

13K+ Views

Java Program to Add Characters to a String Java provides different ways to add characters to a string. We can add characters in the beginning or at the end or at any position according to the need. In this article, we are going to see three different approaches to do so: Using '+' operator Using methods of StringBuffer and StringBuilder classes ... Read More

How to use Weka Java API in ML

Jay Singh
Updated on 25-Apr-2023 13:47:48

2K+ Views

The Weka Java API is a potent machine-learning tool that makes it easy for programmers to incorporate Weka algorithms into Java applications. Complicated machine-learning models can be easily constructed using the Weka Java API's strong built-in data preparation, classification, regression, clustering, and visualization features. Weka includes a wide range of preprocessing methods, including normalization, discretization, and feature selection, and supports a number of file formats, including CSV, ARFF, and C4.5. Only a handful of the machine-learning methods offered by Weka include neural networks, SVMs, decision trees, and random forests. Developers can quickly train and assess machine learning models, as well ... Read More

Java program to check whether the number is divisible by 5

Tapas Kumar Ghosh
Updated on 14-Feb-2025 18:29:41

4K+ Views

In mathematics, the divisibility rule of 5 states that if the number ends with 0 or 5 then it will divisible by 5. There is another way to identify the divisibility rule of 5, if the remainder comes to 0 it returns the number is divisible by 5. The mod(%) operator is normally used in programming when it comes to divisibility. Following are some examples which helps you to understand the divibility rule of 5 − Given number is 525, the number ends with 5 and it is divisible by 5. Given number is 7050, the number ends with ... Read More

Difference between ArrayList and Vector

Pradeep Kumar
Updated on 19-Apr-2023 17:13:02

2K+ Views

We can store and manage a list of items using the Java Collections Framework classes ArrayList and Vector. Nonetheless, it's crucial to recognise some significant distinctions between the two. We will examine the efficiency, synchronisation, and iterator capabilities of ArrayList and Vector, as well as their similarities and differences, in this tutorial. You will have a comprehensive knowledge of when to utilise ArrayList or Vector in your Java projects by the end of this course. then let's get going! What is an ArrayList? Java's ArrayList class offers an implementation of a dynamic array. It is a resizable array that may ... Read More

Best Java IDEs {With Pros and Cons}

Pradeep Jhuriya
Updated on 19-Apr-2023 13:00:58

473 Views

Introduction Java is one of the most widely used programming languages, and its popularity is not without reason. Java's versatility, scalability, and efficiency have made it a popular choice for developing a wide range of applications, from web to mobile to desktop applications. As a result, there are many Integrated Development Environments (IDEs) available for Java that aim to make the development process easier and more efficient. In this article, we will compare some of the best Java IDEs available, highlighting their pros and cons. Whether you are a beginner or an experienced developer, this article will provide valuable insights ... Read More

Java Math incrementExact(int x) method

Rinish Patidar
Updated on 18-Apr-2023 15:31:52

192 Views

We will explore Java Math incrementExact(int x) method by using the function in Java and understanding its different functionalities. An incrementExact() function is an in-built function in Java in the Math library. This function is used to return a value equal to the parameter passed in the function increased by 1. The function returns an exception due to integer overflow if the value of the integer passed in the function as an argument overflows depends on the data type passed in the function i.e. either int or long.Syntax Syntax of the function − int a; int incrementExact(a); long a; ... Read More

Advertisements