Java Keywords

java keywords

Java Reserved and Contextual Keywords

Java has 51 reserved words and 16 contextual keywords that cannot be used as identifiers in the code. Programmers should not use these keywords for other purposes.

Python continue Statement

Python continue statement skips the rest of the code inside a loop for the current iteration in a Loop and jumps the program execution to the beginning of the enclosing loop. If the continue statement is inside a nested loop (one loop inside another loop), the continue statement skips only …

The yield keyword in Java

Introduced in Java 13 as part of the enhancements in Project Amber, the ‘yield‘ keyword aims to simplify code, making switch expressions more concise and expressive. Let us learn about ‘yield‘ keyword, its purpose, syntax, and see some practical examples. 1. The ‘yield‘ Keyword The ‘yield’ keyword enhances the switch …

Difference between this and super in Java

this and super are reserved keywords in Java. this refer to current instance of a class while super refer to the parent class of that class where super keyword is used.

Difference between final, finally and finalize in Java

In this Java tutorial, learn about difference between final, finally and finalize in detail. In short, final is a keyword, finally is a block and finalize is a method. They have their own very specific purpose in Java programs.

Java synchronized keyword

Java synchronized keyword marks a block or method a critical section. A critical section is where one and only one thread is executing at any given time.

Java boolean keyword

Java boolean keyword is used to declare a variable as a boolean type which represents only one of two possible values i.e. either true or false.

Java Abstract Classes and Methods

Java abstract keyword can be used with classes and methods; but not with variables. abstract is non-access modifier which helps in achieving abstraction.

Java continue Keyword

The Java continue statement skips the current iteration of a for loop, while loop, or do-while loop and moves to the next iteration.

Java break Statement

The break keyword in Java is used to terminate for, while, or do-while loops. It may also be used to terminate a switch statement as well.

Java Do-while

Java do-while loop executes the statements in do block, and then evaluates a condition in the while block to check whether to repeat the execution.

Java while Loop

The while loop in Java continually executes a block of statements until a particular condition evaluates to true, else the loop terminates.

Java For-each Loop

Since Java 1.5, the for-each loop or enhanced for loop is a concise way to iterate over the elements of an array and a Collection.

Java For Loop

Java for-loop statement is used to iterate over the arrays or collections using a counter variable that is incremented after each iteration.

Java If-else

Java if-else statements help the program execute the blocks of code only if the specified test condition evaluates to either true or false.

Java transient keyword example

The Java transient keyword is used on class attributes/variables to indicate that serialization process of such class should ignore such variables while creating a persistent byte stream for any instance of that class. A transient variable is a variable that can not be serialized. According to Java Language Specification [jls-8.3.1.3] …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.