Learn Java Programming

Java Basics

Logical Operators in Java

Logical operators are used to make logical decisions. Logical operators are mainly used in conditional statements and loops to make logical decisions. Logical Operators in Java There are three kinds of logical operators. Operator Name Operator Example Logical AND && x && y Logical OR || x || y Logical

Relational Operators in Java with Examples

The Relational Operators are used to check the relationship between the two operands. Relational Operators identifies the relationship with an operand over another operand. For example Ram is taller than Bala. The relational operators compares an operand with another operand to find the relationship between them. The relational operator in

How to use Bitwise Operator in Java

Bitwise operators in Java manipulate individual bits of a number. Bitwise Operator in Java is used on integral types, byte, short, int and long. Java Bitwise Operators includes AND, OR, NOT, XOR, Left & Right Shift Operator, OR Operator, AND Operator, XOR Operator and Compliment Operator in Java. Unlike C

Switch Case Java

The switch case in java matches the given value from multiple values and executes the corresponding switch statement. Java Switch contains multiple cases. In each switch case, there is a code block.The Java switch case expression is used to evaluate a variable with several values. The Switch case supports Enum,

Ternary Operator Vs If Else

The java ternary operator or conditional operator is supported in languages such as java, javascript, python, c / c++, c# etc. The java ternary operator or conditional operator takes three operands, one condition followed by a question mark (?), then an expression to be executed if the condition is true

Break Statement in Java

Break statements are used to terminate the loop immediately, based on the condition and continues to executes the following code to the loop. Break statements are used in the switch statements and loops such as for, while & do while loop. As break terminates on condition, break should be added

Continue Statement with example in Java

Continue statements in java is used to terminate the rest of the code in the loop and execute the next iteration. Java Continue statement is used for any type of loop, but is usually used for, while, do-while loops and foreach. The continue statement jumps immediately to the next iteration

Synchronization in Java with simple example

Synchronization is a process that does not allow more than one thread for a resource at any time. In the java multi-threaded environment, multiple threads attempt to access the same resource, leading to incorrect and unforeseen outcomes. To prevent this from happening, Synchronization controls threads for sequential access to resources.

Java program to write into a text file

Writing to a file in Java is known as writing content from a java variable value or object to a text or binary file using stream classes like FileWrite, FileOutputStream, PrintWriter, NIO and so on. The FileWriter class is used to write in a text file using java. BufferWriter is

Java Bean Standard, Specification, Properties, Requirements

A Java Bean is a java class that should follow the java bean standards and requirements. If a java class meets the java bean specification, the java class is called as java bean. The java bean has some properties and characteristics. A JavaBean is a java class which should follow