- 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
3K+ Views
In this article, we will understand how to find even sum of Fibonacci Series till number N. A Fibonacci series is sequence of numbers formed by the sum of its two previous integers. An even Fibonacci series is all the even numbers of the Fibonacci series.Fibonacci series generates the subsequent number by adding two previous numbers. Fibonacci series starts from two numbers − F0 & F1. The initial values of F0 & F1 can be taken 0, 1 or 1, 1 respectively.Fn = Fn-1 + Fn-2Hence, a Fibonacci series can look like this −F8 = 0 1 1 2 3 ... Read More
976 Views
In this article, we will understand how to check whether the input number is a neon number. A neon number is such a number whose sum of digits of square of the number is equal to the number.Below is a demonstration of the same −InputSuppose our input is −9OutputThe desired output would be the following because 92 = 81 i.e. 8 + 1 = 9The given input is a neon number AlgorithmStep1- Start Step 2- Declare an integers my_input Step 3- Prompt the user to enter an integer value/ Hardcode the integer Step 4- Read the values Step 5- Compute ... Read More
9K+ Views
In this article, we will understand how to print alphabets from A to Z or a to z in Java. This is accomplished using a simple for loop.Below is a demonstration of the same −InputSuppose our input is −A to ZOutputThe desired output would be −A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AlgorithmStep1- Start Step 2- Declare a character: my_temp Step 3- Run a for loop from A to Z and print the values using the increment operator Step 4- Display ... Read More
29K+ Views
In this article, we will understand how to display all the prime numbers from 1 to N in Java. All possible positive numbers from 1 to infinity are called natural numbers. Prime numbers are special numbers who have only two factors 1 and itself and cannot be divided by any other number.A number is a prime number if its only factors are 1 and itself. 11 is a prime number. Its factors are 1 and 11 itself. Some examples of prime numbers are 2, 3, 5, 7, 11, 13 and so on. 2 is the only even prime number. All ... Read More
2K+ Views
In this article, we will understand how to add two complex numbers in Java. They have the ‘I’ that is, an imaginary part associated with it.Below is a demonstration of the same −InputSuppose our input is −15 +i24 and 3 +i7OutputThe desired output would be −18 +i31 AlgorithmStep1- Start Step 2- Declare three Complex numbers: my_input_1, my_input_2 and my_result Step 3- Hardcode the complex number values Step 4- Define a function add_complex_number when u add the real numbers and the imaginary numbers separately and return the result. Step 5- Store the result in my_result variable. Step 6- Display the result ... Read More
3K+ Views
In this article, we will understand how to add two binary strings in Java. A binary string is a sequence of numbers represented in bytes 0s and 1s.Below is a demonstration of the same −InputSuppose our input is −10101 10001OutputThe desired output would be −100110 AlgorithmStep 1- START Step 2- Create new scanner object Step 3- Enter two binary inputs Step 4- Define a carry flag Step 5- Use while condition to check if they are equal to 0 Step 6- If not, use the % operator and the carry flag to perform bitwise addition Step 7-Display it as result ... Read More
2K+ Views
In this article, we will understand how to get an input from user in Java. This achieved using a scanner object. The Scanner.nextInt() method is used to get the input.The java.util.Scanner.nextInt() method Scans the next token of the input as an int. An invocation of this method of the form nextInt() behaves in exactly the same way as the invocation nextInt(radix), where radix is the default radix of this scanner.Below is a demonstration of the same −InputSuppose our input is −Hello, I am John!OutputThe desired output would be −The input string is: Hello, I am John! AlgorithmStep1- Start Step 2- ... Read More
923 Views
In this article, we will understand how to read a number from standard input in Java. The Scanner.nextInt() method is used to read the number. The java.util.Scanner.nextInt() method Scans the next token of the input as an int. An invocation of this method of the form nextInt() behaves in exactly the same way as the invocation nextInt(radix), where radix is the default radix of this scanner.Below is a demonstration of the same −InputSuppose our input is −55OutputThe desired output would be −The input value is 55AlgorithmStep1- Start Step 2- Declare an integer: value Step 3- Prompt the user to enter ... Read More
9K+ Views
When we enter the coding world there are various mathematical operations that we learn to do through programming languages. We are expected to begin our coding journey with basic mathematical operations like adding, subtracting, multiplying and dividing. To evaluate the sum of two numbers, we use the '+' operator. However, Java also provides other approaches for adding two numbers. This article aims to explore the possible ways to add the two numbers in Java. To add the two numbers in Java, we are going to use the following approaches − By taking input of operands from user By ... Read More
15K+ Views
In this article, we will understand how to print a string in Java. A string is a pattern of characters and alphanumeric values. The easiest way to create a string is to write −String str = "Welcome to the club!!!"Whenever it encounters a string literal in your code, the Java compiler creates a String object with its value in this case, " Welcome to the club!!!'.As with any other object, you can create String objects by using the new keyword and a constructor. The String class has 11 constructors that allow you to provide the initial value of the string ... Read More