Keywords In Java

In this page, we will learn about Simple Java Programs, Keywords In Java, Java Keywords, and What are the Java Keyword?


Java Keywords

Java keywords are also known as reserved words. Keywords are particular words which acts as a key to a code and these are predefined words by Java so it cannot be used as variable or object name.

Keywords In Java Are:

boolean float long int short byte char double
switch break case synchronized class continue default do
if else enum extends final finally for implements
import instanceof interface native new null package private
this throw throws transient void volatile while try
  • abstract: Java abstract keyword is employed to declare abstract category. Abstract category will offer the implementation of interface. It will have abstract and non-abstract strategies.
  • boolean: Java boolean keyword is used to declare a variable as a boolean type. It can only hold True and False values only.
  • break: Java break keyword is employed to interrupt loop or switch statement. It breaks this flow of the program at specified condition.
  • byte: Java computer memory unit keyword is employed to declare a variable that may hold associate 8-bit information values.
  • base: Java case keyword is employed to with the switch statements to mark blocks of text.
  • catch: Java catch keyword is employed to catch the exceptions generated by attempt statements. It should be used once the attempt block solely.
  • char: Java char keyword is employed to declare a variable that may hold unsigned 16-bit Unicode characters
  • class: Java category keyword is employed to declare a category.
  • continue: Java continue keyword is employed to continue the loop. It resumes this flow of the program and skips the remaining code at the desired condition.
  • cefault: Java default keyword is employed to specify the default block of code in an exceedingly switch statement.
  • do: Java do keyword is employed au fait statement to declare a loop. It will ingeminate an area of the program many times.
  • double: Java double keyword is employed to declare a variable which will hold a 64-bit floating-point numbers.
  • else: Java else keyword is employed to point the choicebranches in associate degree if statement.
  • enum: Java enum keyword is employed to outline a hard and fast set of constants. Enum constructors square measure perpetually personal or default.
  • extends: Java extends keyword is employed to point that category|a category} springs from another class or interface.
  • final: Java final keyword is employed to point that a variable holds a continuing worth. it's applied with a variable. it's accustomed limit the user.
  • finally: Java finally keyword indicates a block of code in a very try-catch structure. This block is usually dead whether or not exception is handled or not.
  • float: JJava float keyword is employed to declare a variable which will hold a 32-bit number.
  • for: Java for keyword is employed to start out a for loop. it's accustomed execute a collection of instructions or functions repeatedly once some conditions become true. If the amount of iteration is fastened, it's counseled to use for loop.
  • if: Java if keyword tests the condition. It brings of the if block if condition is true.
  • implements: Java implements keyword is employed to implement associate interface.
  • import: Java import keyword makes categories and interfaces on the market and accessible to this ASCII text file.
  • instanceof: Java instanceof keyword is employed to check whether or not the thing is associate instance of the desired category or implements associate interface.
  • int: Java int keyword is employed to declare a variable which will hold a 32-bit signed whole number.
  • interface: Java interface keyword is employed to declare associate interface. It will have solely abstract strategies.
  • long: Java long keyword is employed to declare a variable which will hold a 64-bit whole number.
  • native: Java native keyword is employed to specify that a technique is enforced in native code exploitation JNI (Java Native Interface).
  • new: Java new keyword is employed to form new objects.
  • null: Java null keyword is employed to point that a reference doesn't ask something. It removes the rubbish worth.
  • package: Java package keyword is employed to declare a Java package that has the categories.
  • private: Java non-public keyword is associate access modifier. it's accustomed indicate that a technique or variable is also accessed solely within the category within which it's declared.
  • protected: Java protected keyword is associate access modifier. It will be accessible among package and out of doors the package however through inheritance solely. It cannot be applied on the category.
  • return: Java public keyword is associate access modifier. it's accustomed indicate that associate item is accessible anyplace. it's the widest scope among all different modifiers.
  • short: Java short keyword is employed to declare a variable which will hold a 16-bit whole number.
  • static: Java static keyword is employed to point that a variable or technique may be a category technique. The static keyword in Java is employed for memory management principally.
  • strictfp: Java strictfp is employed to limit the floating-point calculations to confirm movability.
  • super: Java super keyword may be a reference variable that's accustomed refer parent category object. It will be accustomed invoke immediate parent category technique.
  • switch: The Java switch keyword contains a switch statement that executes code supported take a look at worth. The switch statement tests the impartiality of a variable against multiple values.
  • synchronized: Java synchronal keyword is employed to specify the important sections or strategies in multithreaded code.
  • this: Java this keyword will be accustomed refer this object in an exceedingly technique or creator.
  • throw: Java throw keyword is employed to expressly throw associate exception. The throw keyword is principally accustomed throw custom exception. it's followed by associate instance.
  • throws: The Java throws keyword is employed to declare associate exception. Checked exception will be generated with throws.
  • transient: Java transient keyword is employed in publishing. If you outline any knowledge member as transient, it'll not be serialized.
  • Try: Java attempt keyword is employed to begin a block of code which will be tested for exceptions. The attempt block should be followed by either catch or finally block.
  • Void: Java void keyword is employed to specify that a technique doesn't have a come back worth.
  • Volatile: Java volatile keyword is employed to point that a variable could modification asynchronously.
  • While: Java whereas keyword is employed to begin a jiffy loop. This loop iterates a neighborhood of the program many times. If the amount of iteration isn't fastened, it's counseled to use whereas loop.