- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 9321 Articles for Object Oriented Programming
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
An anagram is a word or phrase formed by rearranging the letters of two or more words. Hence, the logic to check whether two given strings are anagram or not is as follows: Suppose there are two strings, if both strings contain the same set of letters along with the same number of letters regardless of their order, then we can say that both strings are anagram otherwise not. Now, let's understand how we can implement this logic in our Java programs to find if two strings are anagram or not. Problem Statement Before jumping to the Java programs to ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
9K+ Views
In number theory, an Armstrong number is a pattern based number whose sum of each digit raised to the power of total number of digits is equal to the given number itself. Hence, to check whether a number is an Armstrong or not, first, determine the total number of digits and assume it 'n'. Then separate each digit and raise them to the power of 'n'. In the last step, calculate the power of each digit and add all of them. If the sum we get is equal to the original number, then it is an Armstrong number otherwise not. ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
951 Views
In this article, we will understand how to check if an array contains the given value. This is accomplished by iterating upon the array elements and comparing the given input with the array elements.Below is a demonstration of the same −InputSuppose our input is −Enter the number to be searched: 25 The elements in the integer array: 15 20 25 30 35OutputThe desired output would be −The array contains the given value AlgorithmStep 1 - START Step 2 - Declare three integer values namely my_input , i, array_size. A Boolean value my_check is defined and an integer array my_array is defined ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
612 Views
Whether the specified number is positive or negative can be defined with respect to 0. A number greater than 0 is considered a positive number whereas a number less than 0 is considered a negative number. To check whether a given number is positive or negative in Java, we can use Java conditional statements like if-else blocks or ternary operators. In this article, we are going to explore the mentioned ways to identify if a number is positive or negative with the help of Java programs. Java Program to Check Whether a Number is Positive or Negative In this ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
583 Views
In this article, we will understand how to check whether a number is even or odd. This is accomplished by checking if the given number is divisible by 2.Below is a demonstration of the same −InputSuppose our input is −Enter the number : 45OutputThe desired output would be −The number 45 is an odd number AlgorithmStep 1 - START Step 2 - Declare an integer values namely my_input. Step 3 - Read the required values from the user/ define the values Step 4 - Use the modulus operator and compute my_input % 2 value. Step 5 - If the result is 0, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
397 Views
In this article, we will understand how to find sum of N numbers using recursion. A recursive function is a function that calls itself multiple times until a particular condition is satisfied.Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.Many programming languages implement recursion by means of stacks. Generally, whenever a function (caller) calls another function (callee) or itself as callee, the caller function transfers execution control to the callee. This transfer ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
496 Views
In this article, we will understand how to find the product of two numbers using recursion. A recursive function is a function that calls itself multiple times until a particular condition is satisfied.Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.Many programming languages implement recursion by means of stacks. Generally, whenever a function (caller) calls another function (callee) or itself as callee, the caller function transfers execution control to the callee. This ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
684 Views
In this article, we will understand how to find sum of digits of a number using recursion. A recursive function is a function that calls itself multiple times until a particular condition is satisfied.Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.Many programming languages implement recursion by means of stacks. Generally, whenever a function (caller) calls another function (callee) or itself as callee, the caller function transfers execution control to the callee. ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
21K+ Views
In this article, we will understand how to pass method call as arguments to another method. We can call a method from another class by just creating an object of that class inside another class. After creating an object, call methods using the object reference variable.Below is a demonstration of the same −InputSuppose our input is −Enter two numbers : 2 and 3OutputThe desired output would be −The cube of the sum of two numbers is: 125AlgorithmStep 1 - START Step 2 - Declare two variables values namely my_input_1 and my_input_2 Step 3 - We define a function that takes ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
434 Views
In this article, we will understand how to pass lambda expression as a method argument. A lambda expression is a short block of code which takes in parameters and returns a value.Below is a demonstration of the same −InputSuppose our input is −("Apple", "Orange", "Grapes")OutputThe desired output would be −elppA, egnarO, separG AlgorithmStep 1 - START Step 2 - We import the required packages. Step 3 - In the main function, we define an ‘ArrayList’ of data. Step 4 - This is displayed on the console. Step 5 - Now, a ‘forEach’ loop is used to iterate over the elements ... Read More