Java Program to Check Whether a Character is Alphabet or Not
Example 1: Java Program to Check Alphabet using if else public class CheckAlphabet { public static void main(String[] args) { //declare a variable char c = 'E'; //check if c…
Example 1: Java Program to Check Alphabet using if else public class CheckAlphabet { public static void main(String[] args) { //declare a variable char c = 'E'; //check if c…
Example: Check if a Number is Positive or Negative using if else public class CheckPositiveNegative { public static void main(String[] args) { double number = 14.3; // true if number…
Leap year is a year which is divisible by 4 and if a century year is a leap year then it must be divisible by 400. Example: Java Program to…
Example 1: Java Program to Convert int to double using Typecasting class IntToDouble { public static void main(String[] args) { // create two int variables int a =99; int b…
Example 1: Java Program to Convert int to string using valueOf() class IntToString { public static void main(String[] args) { // create two int variable int num1 = 56; int…
Example 1: Java Program to Convert string to int using parseInt() class StringToInt { public static void main(String[] args) { // create two string variables String str1 = "43"; String…
Example 1: Convert string to boolean using parseBoolean() class StringToBoolean { public static void main(String[] args) { // create two string variables String str1 = "true"; String str2 = "false";…
Example 1: Convert boolean to string using valueOf() class BooleanToString { public static void main(String[] args) { // create two boolean variables boolean booleanValue1 = true; boolean booleanValue2 = false;…
In the last Program we learnt about converting a long to int and now we will do vice-versa. Example 1: Java Program to Convert int to long using Typecasting class…
Example 1: Java Program to Convert long to int using Typecasting class LongToInt { public static void main(String[] args) { // create long variables long a = 2322331L; long b…