
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 9150 Articles for Object Oriented Programming

5K+ Views
In this article, we'll generate the Fibonacci series using a while loop in Java. The Fibonacci series is a sequence where each number is the sum of the two previous numbers, starting with two initial numbers, usually either (0, 1) or (1, 1). Here, we start with (1, 1) and use a while loop to print the next numbers in the sequence until a specified limit. Steps to print the Fibonacci series using while loop Following are the steps to print the Fibonacci series using the while loop − Define a class and initialize three variables: a ... Read More

13K+ Views
In this article, we will learn to find whether a given character is a vowel or consonant using Java. In the English alphabet, the characters 'a', 'e', 'i', 'o', and 'u' are vowels and the remaining letters are consonants. To find whether the given letter is a vowel or consonant. Using a loop and or operator verify whether the given character is 'a' or 'e' or 'i' or 'o' or 'u' else it is consonant. Steps to find whether given character is vowel or consonant Following are the steps to find whether given character is a vowel or consonant− ... Read More

4K+ Views
The factorial of a number is a fundamental concept in mathematics, representing the product of all positive integers up to that number. Calculating the factorial of a given number is a common problem in programming, and Java provides a straightforward way to achieve this using a while loop. A factorial of a particular number (n) is the product of all the numbers from 0 to n (including n) i.e. factorial of the number 5 will be 1*2*3*4*5 = 120. Problem Statement Given a number write a Java program to calculate the factorial using while loop. Input ... Read More

624 Views
In this article, we will learn how to swap two numbers using the XOR bitwise operator in Java. The XOR operator is a powerful tool that allows you to perform bitwise operations, and one of its interesting properties is that it can be used to swap two variables without using a temporary variable. This method is efficient and can be used when you need a fast swapping mechanism. Problem StatementGiven two integers, write a Java program to swap their values using the XOR operator.Input Two integers are provided by the user.Output The values of the two integers after swapping. ... Read More

9K+ Views
The circumference of a circle is double the product of its radius and the value of PI. Therefore, to calculate the circumference of a circleGet the radius of the circle form the user.Calculate the productPrint the final result.Example: Finding the circumference of a circle import java.util.Scanner; public class CircumfrenceOfCircle { public static void main(String args[]){ int radius; double circumference; Scanner sc = new Scanner(System.in); System.out.println("Enter the radius of the circle ::"); radius = sc.nextInt(); circumference = Math.PI*2*radius; System.out.println("Circumference ... Read More

22K+ Views
Area of a circle is the product of the square of its radius, and the value of PI, Therefore, to calculate the area of a rectangleGet the radius of the circle.Calculate the square of the radius.Calculate the product of the value of PI and the value of the square of the radius.Print the result.Exampleimport java.util.Scanner; public class AreaOfCircle { public static void main(String args[]){ int radius; double area; Scanner sc = new Scanner(System.in); System.out.println("Enter the radius of the circle ::"); radius = sc.nextInt(); ... Read More

4K+ Views
Area of a triangle is half the product of its base and height. Therefore, to calculate the area of a triangle.Get the height of the triangle form the user.Get the base of the triangle form the user. Calculate their product and divide the result with 2.Print the final result.Exampleimport java.util.Scanner; public class AreaOfTriangle { public static void main(String args[]){ int height, base, area; Scanner sc = new Scanner(System.in); System.out.println("Enter the height of the triangle ::"); height = sc.nextInt(); System.out.println("Enter the base of the triangle ::"); ... Read More

15K+ Views
Area of a rectangle is the product of its length and breadth. Therefore, to calculate the area of a rectangleGet the length of the rectangle form the user.Get the breadth of the rectangle form the user.Calculate their product.Print the product.ExampleBelow is an example to find the area of a rectangle in Java using Scanner class.import java.util.Scanner; public class AreaOfRectangle { public static void main(String args[]){ int length, breadth, area; Scanner sc = new Scanner(System.in); System.out.println("Enter the length of the rectangle ::"); length = sc.nextInt(); ... Read More

9K+ Views
Given a square whose length of all its sides are l, write a Java program to find its area. A square is a rectangle whose length and breadth are same. Therefore, area of this type of rectangle is the square of its length. To calculate the area of square in Java, you simply need to multiply the given length of square with the length itself and store the result in another variable. Java Program to Find The Area of a Square A Java program that illustrates how to find the area of the square is shown below − public class ... Read More

3K+ Views
The Set interface does not allow duplicate elements, therefore, create a set object and try to add each element to it using the add() method in case of repetition of elements this method returns false − If you try to add all the elements of the array to a Set, it accepts only unique elements so, to find duplicate characters in a given string. Problem Statement Given a string, write a program in Java to delete duplicate characters from a given string − Input TUTORIALSPOINT Output Indices of the duplicate characters in the given string :: Index :: ... Read More