Keywords in JAVA

Hello readers, in today’s topic we will discuss various types of keywords in Java. Previously we also discussed various important topics of Java like Data Types in Java, Operator in Java, Variables & Constant in Java, and many more. So without wasting any time let’s dive into today’s topic:

Keywords in JAVA

Keywords in Java are reserved words by the compiler which has a special function and set of definitions.  Here the meaning of the reserved words is that these keywords are already predefined by Java so these cannot be used or not allowed for any other program elements like variable or identifier or object name or class name, methods etc. These are the fixed word which is used for a particular purpose.

Till now there are 52 keywords in java these are:

abstractcontinuefornewswitch
assertdefaultgotopackagesynchronized
booleandoifprivatethis
breakdoubleimplementsprotectedthrow
byteelseimportpublictransient
caseenuminstanceofreturntry
catchextendsintshortvoid
charfinalinterfacestaticvolatile
classfinallylongstrictfpwhile
constfloatnativesuperthrows
exportsmodulerequiresvar 

abstract: abstract keyword in Java is generally used for declaring the abstract class, it can only be used in the abstract class and it does not have any body. It provides the implementation of the interface.

assert : assert keyword is used for debugging

boolean : boolean is a data type that is used to store boolean values i.e. true or false.

break : break keyword in Java is generally used to break the loop, conditions, or switch statement.

byte : byte is a data type that is used to store integer type and it holds 8 bits of data.

case : case keyword is used in the switch statement and is used to mark blocks of text.

catch : catch is a keyword that is used by try…catch…  block in exception handling.

char : it is a data type that can hold characters of 16 bit.

class : class is a keyword that is used to declare a new class name.

exports : export keyword is used to export a package with a module.

continue : continue keyword is used to continue to the next iteration of the loops.

default : default keyword in Java is used to specify the default block of code after completion.

do : do keyword is used in the control statement to declare a loop.

double : it is a data type used to declare a variable that can store a 64-bit floating point number.

else : else keyword is used in a conditional statement to indicate the alternative branches of the if statement.

Note : Here the keywords ‘const’ and ‘goto’ are reserved word but they are not currently in use in Java i.e. no longer supported in Java.

Note : Even true, false and null are looks like keyword, but these are actually not keywords, they are literals and also reserved word so these are cannot be used as identifiers or variables.

So these are all about keywords in java which are different types and every keyword has unique functionality. I hope this is helpful to you. In the next upcoming post we will discuss another new topic of java, so wait for this will meet soon in the next post. Thank you.

Leave a Reply

Your email address will not be published.

Sorry
Sorry
Sorry
Sorry
Sorry
Sorry
Sorry