
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7442 Articles for Java

470 Views
In this article, we will learn to check if any two out of three boolean values are true or not. Boolean variables are datatypes that contain only true or false values. Below is a demonstration of the same - Input: true, true, falseOutput : Two of the three variables are true Checking if two of three Boolean variables are trueIn this article, we will discuss two approaches to check it, and they are - Using if-else Condition ... Read More

15K+ Views
In this article, we will understand how to implement multiple inheritance. Unlike other programming languages, such as C++, Java does not support multiple inheritance through classes. This means that a class cannot inherit from more than one class. But why? Let's understand first what multiple inheritance is and why it is so. Multiple Inheritance Multiple Inheritance is one of the features of object-oriented programming, where a class (child class) can inherit properties of more than one class (parent class) using the extends keyword. But Java does not support this to avoid complexity and ambiguity. It can ... Read More

2K+ Views
To count number of vowels and consonants in a given String, we can use the switch statement and if-else condition in Java. Alphabets that include 'a' 'e' 'i' 'o' 'u' are called Vowels and all other alphabets are called Consonants. Let's understand the problem statement with an example scenario. Example Scenario Suppose our input string is: Input: Hello, my name is Charlie Output: Vowels = 8, Consonants = 12 In the given string, the collective count of vowels is 8 and consonants is 12. Using switch Statement Run a for-loop, check each letter whether it is a consonant or ... Read More

1K+ Views
Given an integer a and a non-zero integer d, our task is to write a Java program to compute the quotient and remainder. Quotient can be calculated using the formula "Quotient = Dividend / Divisor" and for remainder, use "Remainder = Dividend % Divisor". When a number, i.e., dividend, is divided by another number, i.e., divisor, the quotient is the result of the division, while the remainder is what is left over if the dividend does not divide completely by the divisor. Example Scenario Suppose our input is - Input1: Dividend = 50 Input2: Divisor = 3 The output ... Read More

1K+ Views
For a given character, say "ch", write a Java program to print its ASCII value. We can find the ASCII value of any character by assigning it to an integer value and printing that integer value. The term ASCII stands for American Standard Code for Information Interchange. There are 128 standard ASCII codes, each of which can be represented by a 7-digit binary number: 0000000 through 1111111. Extended ASCII adds an additional 128 characters that vary between computers, programs and fonts. Example Scenario: Input: character = s; Output: ascii_value = 115 Example 1 In this example, we are printing ... Read More

765 Views
The octal number system has a base value of 8 as it contains digits from 0 to 7, i.e., 8. On the other hand, the decimal number system has 10 digits from 0 to 9. Hence, its base value is 10. In this article, we will learn to convert decimals to the octal number system in Java. Problem Statement The goal is to write a program to convert a given decimal number (base 10) into its equivalent octal number (base 8). Example Scenario: Input: int decimalNumber = 8 Output: The octal value is = 10 Converting Decimal to Octal in ... Read More

1K+ Views
For a given rectangle of length l and width w, write a Java program to find its perimeter. The Perimeter of a rectangle is calculated by adding the lengths of all the sides of the rectangle. Below is a demonstration of a rectangle, a quadrilateral with four right angles (90°). The perimeter of a rectangle is the total length of the two lengths and two widths of the rectangle − Example Scenario: Input: length = 5, 8, 5, 8; Output: Perimeter = 26 On adding all the sides of rectangle, you will get perimeter. 5+8+5+8 = 26 Steps ... Read More

16K+ Views
In this article, we will understand how to calculate compound interest in Java. Compound interest is calculated using the following formula. Amount = P(1 + R/100)t Compound Interest = Amount - Principle where, P is the principal amount T is the time R is the rate Compound interest is the interest calculated on the initial principal and also on the accumulated interest of previous periods. In other words, Compound Interest = Interest on Principal + Interest on Interest. We'll learn how to get user input for the principal amount, interest rate, and time period, and then calculate the compound interest based ... Read More

3K+ Views
In this article, we will understand how to write a Java program to calculate simple interest. But, before doing it, let's understand how we calculate simple interest mathematically. The simple interest is a way to determine the amount of interest gained on a principal amount at the specified interest rate for a given time. Unlike compound interest, its principal amount does not change over time. To calculate Simple Interest, we use the following formula− Simple Interest (S.I) = Principal * Time * Rate / 100 where, P is the principal amount T is the time R is the rate ... Read More

3K+ Views
In this article, we will learn how to find the even sum of the Fibonacci series up to a given number N. A Fibonacci series is a series where the next term is the sum of the previous two terms. An even Fibonacci series is a group of all the even numbers in the Fibonacci series. The first two terms of the Fibonacci sequence are 0 and 1. Fn = Fn-1 + Fn-2 Hence, a Fibonacci series can look like this - F8 = 0 1 1 2 3 5 8 13 or, this F8 = 1 1 2 3 5 ... Read More