Monthly Archives: July 2020

how to check if string contains only alphabets in java

How to check if string contains only alphabets in java: To check whether a string contains only alphabets or not, implement below logic.

Output:

  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 »

how to check if string contains only digits in java

How to check if string contains only digits in java: To check whether a string contains only digits or not, implement below logic.

Output:

  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 »

Operators in Java

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 »

Widening and Narrowing in Java

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 »

Type casting in Java

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 »

Java variable declaration and assignment

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 »

Java Data Types

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 »