Swap two numbers without using third variable in Java
Selenium99
by SeleniumExpert
3y ago
Swap two numbers without using third variable in Java: You have given two numbers and you have to swap two numbers without using third variable in Java. When you use a third variable its easy to to swap numbers as below. [crayon-5f2bdc98d4dab344570128/] But when you can’t use third/temporary variable then you can follow below method.… Read More ..read more
Visit website
How to check if string contains only alphabets in java
Selenium99
by SeleniumExpert
3y ago
How to check if string contains only alphabets in java: To check whether a string contains only alphabets or not, implement below logic. [crayon-5f2a8596aa066092935243/] Output: [crayon-5f2a8596aa06f364331400/]   Recommended Posts: How to check if string contains only digits in Java How to remove last element from an ArrayList Remove element from ArrayList How to swap two… Read More ..read more
Visit website
How to check if string contains only digits in java
Selenium99
by SeleniumExpert
3y ago
How to check if string contains only digits in java: To check whether a string contains only digits or not, implement below logic. [crayon-5f2a8596aa812964900263/] Output: [crayon-5f2a8596aa81a769047691/]   Recommended Posts: How to check if string contains only alphabets in Java How to remove last element from an ArrayList Remove element from ArrayList How to swap two… Read More ..read more
Visit website
Operators in Java
Selenium99
by SeleniumExpert
3y ago
Operators in Java: Operators are special symbols that perform specific operations in Java. Below are the different types of operators present in Java. 1 Arithmetic operators 2. Bitwise operators 3. Relational operators 4. Boolean logical operators 5. Ternary operator.   1. Arithmetic operators: These are used in mathematical expressions. Operator Description + Additions – Subtraction… Read More ..read more
Visit website
Widening and Narrowing in Java
Selenium99
by SeleniumExpert
3y ago
Widening and Narrowing in Java: In this article, you are going to learn what is widening and narrowing in Java. Widening: Widening is also known as Upcasting. Widening casting is automatic. It happens when we pass a variable of smaller size data type to larger data type. Widening takes place when a reference variable of… Read More ..read more
Visit website
Type casting in Java
Selenium99
by SeleniumExpert
3y ago
Type casting in Java: Automatic, non-explicit change of data type is known as Conversion. Type casting is of two types. 1. Widening / Implicit / Automatic type casting 2. Narrowing / Explicit / Manual type casting.   1 Implicit type casting: Variable of smaller capacity can be assigned to another variable of bigger capacity. byte… Read More ..read more
Visit website
Java variable declaration and assignment
Selenium99
by SeleniumExpert
3y ago
Java variable declaration and assignment: In any Java program, variable is the basic unit of storing data. A variable can be declared by using an identifier i.e the variable name and a data type. We can also initialize a variable when it is declared. In Java, before using any variable, it should be declared. At… Read More ..read more
Visit website
Java Data Types
Selenium99
by SeleniumExpert
3y ago
Java Data Types: Java is a strongly typed language. It means all the variables must be declared before using them. Java data types of are of two types. 1. Primitive data type 2. Non-primitive data type   1. Primitive Data Types: These are predefined by the language and is named by a reserved keyword. Example:… Read More ..read more
Visit website
Generate random number between 1 to 5 in Java
Selenium99
by SeleniumExpert
3y ago
How to generate random number between 1 to 5 in Java: We can use nextInt() method of Random class to generate random number between 1 to 5 in java. [crayon-5f2a8596aad16175468866/] Output: [crayon-5f2a8596aad1a542685584/] Note: If we just use nextInt(5), then it will give a random number between 0 to 4. So if you don’t want 0… Read More ..read more
Visit website
Generate random number between 1 to 10 in Java
Selenium99
by SeleniumExpert
3y ago
How to generate random number between 1 to 10 in Java: We can use nextInt() method of Random class to generate random number between 1 to 10 in java. [crayon-5f2a8596aadef163782290/] Output: [crayon-5f2a8596aadf3688138538/] Note: If we just use nextInt(10), then it will give a random number between 0 to 9. So if you don’t want 0… Read More ..read more
Visit website

Follow Selenium99 on FeedSpot

Continue with Google
Continue with Apple
OR