
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

2K+ Views
To check for Long overflow, we need to check the Long.MAX_VALUE with the multiplied long result, Here, Long.MAX_VALUE is the maximum value of the Long type in Java. Let us see an example wherein long values are multiplied and if the result is more than the Long.MAX_VALUE, then an exception is thrown. Steps to multiply long integers and check for overflow Following are the steps to multiply long integers and check for overflow in Java − Initialize long values by defining two long integers, val1 and val2. Multiply val1 and val2 to ... Read More

1K+ Views
In this article, we will add two long integers in Java and check if the sum causes an overflow, which happens when the result exceeds the maximum value that a long data type can hold, defined by the Long class as Long.MAX_VALUE. If the sum goes beyond this limit, an exception will be thrown to handle the overflow. Otherwise, the sum will be displayed as the result. Steps to add long integers and check for overflow Following are the steps to add long integers and check for overflow − First, we will define two long integers ... Read More

418 Views
To check whether the character is ASCII 7 bit or not, check whether given value’s ASCII value is less than 128 or not.Here, we have a character.char one = '-';Now, we have checked a condition with if-else for ASCII 7-bit character.if (c < 128) { System.out.println("Given value is ASCII 7 bit!"); } else { System.out.println("Given value is not an ASCII 7 bit!"); }The following is an example wherein we check a character for ASCII 7-bit.Example Live Demopublic class Demo { public static void main(String []args) { char c = '-'; System.out.println("Given value = ... Read More

294 Views
To check whether the entered value is ASCII 7-bit control character, check the characters ASCII value before 32 and 127. These are the control characters.Here, we have a character.char one = ' n ';Now, we have checked a condition with if-else to check for character less than 32 (ASCII) and equal to 127.if (one < 32 || one == 127) { System.out.println("Given value is a control character!"); } else { System.out.println("Given value is not a control character!"); }Example Live Demopublic class Demo { public static void main(String []args) { char one = ''; ... Read More

171 Views
In this article, we will discover how we can check whether a value entered is an ASCII 7-bit alphabetic character in Java. This process involves whether a character belongs to the ranges 'a' to 'z' or 'A' to 'Z' in the ASCII table. The character can be checked with some simple if statements to determine if it is in either of these two ranges and then corresponding messages are displayed. Problem StatementGiven a character, write a Java program to check whether the entered value is an ASCII 7-bit alphabetic character or not.Input Initial character = 'r' input = '1'Output Character: ... Read More

157 Views
In this article, we will explore how to verify whether or not a given character is an uppercase letter and, more specifically, falls within the range of A to Z. This is useful when a user’s input consists of some uppercase letter or when a program needs to restrict itself to uppercase letters. We use concepts such as if-else statements, character comparison, and conditional logic to solve this problem. Problem StatementWe need to write a program that checks if a character falls within the uppercase alphabetic range, which spans from 'A' to 'Z'.Input The input will consist of a single character.Output ... Read More

197 Views
In this article, we'll learn how to check whether the entered value is ASCII 7-bit alphabetic lowercase in Java. In ASCII, the lowercase alphabets begin with the character ‘a’ and end with ‘z’. We will write a program checking whether a character is a lowercase alphabetic character using a simple if-else statement. Problem Statement We are given a character, and we need to create a Java program that checks whether the character is a lowercase letter in the ASCII 7-bit range, meaning it falls between 'a' and 'z'. We will also check if the character is uppercase, meaning ... Read More

764 Views
To compare two objects of Character type in Java, use the compareTo() method.Firstly, we have created two Character type.Character one = new Character('m'); Character two = new Character('k');Now, to compare them, we have used the compareTo() method.int res = one.compareTo(two);The following is the example that compares character objects.Example Live Demopublic class Demo { public static void main(String []args) { Character one = new Character('m'); Character two = new Character('k'); System.out.println("Character object 1: "+one); System.out.println("Character object 2: "+two); int res = one.compareTo(two); if ... Read More

2K+ Views
A prime number is a number that is only divisible by one or itself. Some of the prime numbers are 2, 3, 5, 7, 11, 13 etc.Some of the different methods to find a prime number in Java are given as follows −Method 1 - Find if a number is prime without using a functionA program that finds if the given number is prime without using a function is given as follow −Example Live Demopublic class Example { public static void main(String args[]) { int num = 11, flag=0; if(num == 0||num == 1) { System.out.println( num + " is not a prime number"); } else { for(int i = 2; i

6K+ Views
Permutation and Combination are a part of Combinatorics. Permutation is the different arrangements that a set of elements can make if the elements are taken one at a time, some at a time or all at a time. Combination is is the different ways of selecting elements if the elements are taken one at a time, some at a time or all at a time.An example of this is given as follows −Permutation = factorial(n) / factorial(n-r); Combination = factorial(n) / (factorial(r) * factorial(n-r)); n = 5 r = 3 Permutation = 60 Combination = 10A program that demonstrates this ... Read More