Keywords in Java programming language
- Home
- Basic
- Java basic
- Keywords in Java programming language
- On
- By
- 0 Comment
- Categories: Java basic, keyword, Keyword in Java
Keywords in Java programming language
Keywords in Java programming language
In this tutorial, We will discuss the Keywords in Java
In the Java programming language, keywords are reserved words for programming capability. it is used in variables, method, class or as any other identifiers but programmers cannot use keywords as the name of variables, methods, classes, and other identifiers
Keywords in Java
abstract– abstract is a Java keyword used to implement abstraction in java. A method which doesn’t have method definition must be declared as an abstract class. Abstract methods must be implemented in the subclass. You can’t use the abstract keyword with variable and constructor
asset- used for assertions
boolean – This is used to declare a variable as a boolean type. It represents only either true or false in java. Default boolean variables are initialized as false
break – This causes the loop to stop or to exit execution of for loop, while loop, do-while loop and switch case statements
byte – It is used to declare a variable as a numeric type. A byte value holds an 8 bits (a byte holds eight bits signed integer) integer of the primitive data type. This ranges from -128 to 127.
case – This is used to label each branch in a switch statement.
catch – This is a part of a try block used in exception handling
char –The char is a keyword used to declare a variable as a type of character
class – It is used to declare a new class which is a collection of related variables and methods
const – const is a reserved word in Java language as it is not used in Java programme for coding .
continue – It is used to stop the execution of a current iteration in a for loop or a while loop and to advance to the next iteration.
default – default is used in two ways. the default is used to add a default ‘case’ to switch statements in Java.
do – The do keyword is used to implement the do-while loop in java. When we want to execute a block of statement one time in Java, we can use do keyword.
double – the double is a keyword is used to declare a floating point variable as a numeric type.
else -It is used in association with the if keyword in an if-else statement .
enum – It is used to declare a new enumeration type.
extends – a class uses extends keyword in the inheritance process to inherit properties and methods to another class .
final -It is used to restrict the user. When the variable is defined as final, you can not change the value of the final variable .
finally – It is a part of a try block used for exception handling in java –
float – It is used to declare a variable as a numeric type.
for – It is used in the for loop for repeated execution.
if – It is used to create if statement. It is used to test the boolean expression and it indicates the conditional execution of a block.
implements – Used to implement basic concrete of method definition in an interface.
instanceof – used to check the type of an object and runtime.
int – Used to store integer value as numeric type.
interface – Used to define an interface in Java.
long – Used to declare an integer type variable as a numeric type.
native
new – Used to create a java object and allocate memory space in memory disk. new is also used for array creation.
package – Used to declare a namespace for the java class .
private – Declares a member’s access as private(access modifier).
protected – protected is a keyword in java programming language and an access modifier used in class, method, variable.
public – public is a keyword and an access modifier.
return – Used at the end of the code or it stops the execution of a method. When its execution is complete, it returns a value from a method.
short – Used to declare a variable as a type of numeric.
static – Used mainly for memory management.
super – It is a reference variable used mainly to refer to objects in the immediate parent class. This keyword is used in various ways in java.
switch – Used with the switch statement and it gives the option to check a range of value for your variable (Read more)
synchronized – Used to block codes and methods for synchronization
this – Used to refer to the method or constructor of a class.this keyword works as a reference to the current object which is an instance of a current class.
throw -Used to throw an exception from within a method by throw keyword
throws – Used to declare an exception and used to throw one or some exceptions
transient – Used in serialization
try – Used for exception handling to enclose the code that might throw an exception
void – allows the creation of methods without a return value.
volatile – less widely known and less used keyword. The keyword volatile used in the multi-threaded environment.
while – it used in the while loop.
false – false is reserved word. false is a boolean literal value
null –null is a reserved word. null is a reference literal value
true – true is a reserved word. true is a boolean literal value
Suggested for you
Usage of final keyword in Java
Finally keyword in Java language