Skip to content
  • Facebook
GeekCer Logo

GeekCer

The geek's Coding education and Review centre

  • Home
  • Tutorials
    • Java
    • Servlet
    • JSP
    • Python
    • C Tutorial
    • Spring
    • Spring Boot
    • MongoDB
    • Hibernate
    • Data Structure
  • General Knowledge
  • Biography
  • Grammar
  • Festival (त्योहार)
  • Interview
  • Differences
  • Important
  • Toggle search form

Home » Java » Java Keywords

  • What is WAR file in Java
    What is WAR file in Java? Servlet
  • Exception Handling in Java
    Exception Handling in Java Java
  • Gautama Buddha life story in Hindi, Buddha's history
    Gautama Buddha life story in Hindi, Buddha’s history Biography
  • What is Mutual Fund?
    What is Mutual Fund? Important
  • What is Internship? How to get Internship?
    What is Internship and how to get Internship? Important
  • What is Agriculture
    Agriculture (कृषि) से जुड़े महत्वपूर्ण प्रश्न और उत्तर Important
  • Binary search in Data structures In C (Recursive and Iterative)
    Binary search algorithm in C, Recursive, Iterative, examples Data Structure
  • Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth
    Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth Biography

Java Keywords

Posted on August 15, 2021October 11, 2021 By admin
Java Keywords

The Java consists of a set of reserved words that have a predefined meaning in the language which is known as Java Keywords. In this article, you will learn about the java keywords which is the basic unit that helps in creating a class using the declaration of variables in Java.

Let’s start with the basic idea about keywords, and then we will go through some of the main keywords in detail and then finally we will know the basic difference between throw and throws keywords.

Table of Contents

  • What is Java Keyword?
  • List of Java Keywords
  • Basic interview questions related to Java Keywords.
    • What is a static keyword in Java?
    • What is this keyword in Java?
    • What is final keyword in Java?
    • What is super keyword in Java?
    • What is transient keyword in Java?
    • What is the difference between throw and throws keywords in Java?

What is Java Keyword?

Java Keywords implement specific features of the language. These keywords, combined with operators and separators according to a syntax and it forms definition of the Java language. So for the java programmers it is important to know the meaning of the those words (keywords.)

We do not use these reserved words to declare classes, interfaces, variables, methods or any other identifiers. In other words, you cannot use any of the keywords as identifiers in your programs.

Since, Java is case-sensitive, you can use these keywords as identifiers by changing one or more letters in upper case, but it is bad practice and never recommended.

Although const and goto are keywords but they are not in use. And true, false and null are not keywords, they are literals in Java and you cannot use them as identifiers.

List of Java Keywords

List of java keywords or reserved words are as follow:

  • abstract : You can use this keyword to make a abstract class and abstract method.
  • boolean : Declare a variable of boolean type.
  • break : To break out the loop and switch statement.
  • byte : Declare a variable of byte type.
  • case : We use this keyword to switch statement.
  • catch : To catch the exception.
  • char : Declare a variable of char type.
  • class : Declare a class.
  • continue : Skip the current iteration of the loop.
  • default : Create a default block in switch statement.
  • do : We use the do and while together for do-while loop.
  • double : Declare a variable of double type.
  • else : For the conditional statement (if … else)
  • enum : Defines a fixed set of constant.
  • extends : To inherit a class.
  • final : You can use this keyword with the variable, method and class.
  • finally : Block of try…catch statement which is always executed.
  • float : Declare a variable of float type.
  • for : The for loop.
  • if : Conditional statement.
  • implements : To implement an interface.
  • import : Import the classes and interfaces.
  • instanceof : Compatibility check.
  • int : Data type which accepts integer value.
  • interface : To declare an interface.
  • long : The long data type.
  • new : To create an object.
  • package : To define the package of the class.
  • private : The private modifier.
  • protected : The protected modifier.
  • public : The public modifier.
  • return : By using this keyword you return something.
  • short : The short data type.
  • static : The static keyword, you can use this keyword with variable, method, class.
  • super : To represent the base class.
  • switch : For switch statement.
  • this : To point the current object.
  • throw : Throw the user defined error.
  • throws : Pass the exception handling responsibility.
  • try : We use for exception handling.
  • void : It returns nothing.
  • while : The while loop.

Basic interview questions related to Java Keywords.

Apart from above, there are following most basic questions related to Java keywords, which will help you in every interview.

What is a static keyword in Java?

You can use a static keyword with the variable, method, or inner class as a class field. You can access a static method and variable without creating object by using class name only.

What is this keyword in Java?

We use this keyword to refer the current object from constructor and method.

What is final keyword in Java?

We use final keyword with class, method and variable.  A final class cannot be inherited, a final method cannot be overridden, and a value final variable can’t be changed.

What is super keyword in Java?

Basically we use super keyword to refer the parent class.

What is transient keyword in Java?

A transient variable is not serialized.

What is the difference between throw and throws keywords in Java?

The throw keyword is used to create a custom error whereas throws keyword is used to pass the responsibility of exception handling to the caller method.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • More
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Also Read

Java Tags:abstract, break, catch, continue, Double, final, finally, Int, interface, Interview Questions, Keyword, Reserved Word, return, throw, throws, try

Post navigation

Previous Post: Data Types in Java
Next Post: Java Operators

More Related Articles

Java ArrayList Java ArrayList Java
Top Java Programs for Coder Top Java Programs for Coder Java
Java If-else Statement Java If-else Statement Java
Difference between Comparable and Comparator Difference between Comparable and Comparator Differences
Difference between Runnable and Callable in Java Difference between Runnable and Callable in Java Differences
Method Overloading in Java Method Overloading in Java Java

Related Posts

  • Java ArrayList
    Java ArrayList Java
  • Top Java Programs for Coder
    Top Java Programs for Coder Java
  • Java If-else Statement
    Java If-else Statement Java
  • Difference between Comparable and Comparator
    Difference between Comparable and Comparator Differences
  • Difference between Runnable and Callable in Java
    Difference between Runnable and Callable in Java Differences
  • Method Overloading in Java
    Method Overloading in Java Java
  • Java Home
  • Java Comments
  • Java Variables
  • Java Data Types
  • Java Keywords
  • Java Operators
  • Java If-else Statement
  • Java Switch
  • Java Loop
  • Java Arrays
  • Method Overloading in Java
  • Java OOP
  • Java Collections
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Multithreading in java
  • Thread Synchronization
  • Exception Handling
  • Java JDBC Driver
  • Java Database Connectivity steps
  • Lambda Expressions
  • Concurrent Collections

Recent Posts

  • Maharishi Valmiki in Hindi, Biography, Dacoit Ratnakar, Jayanti
  • Structured Vs Unstructured Data in Hindi | Key Difference
  • Jhansi Ki Rani Lakshmi Bai History, Story, Information in Hindi
  • Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth
  • World Environment Day in Hindi : Objective, Importance, Theme
  • Thomas Edison Biography in Hindi – थॉमस एडिसन जीवनी
  • International Nurses Day in Hindi | नर्स दिवस क्यों मनाते हैं?
  • Fork/Join Framework in Java | RecursiveTask, RecursiveAction
  • What is WAR file in Java
    What is WAR file in Java? Servlet
  • Exception Handling in Java
    Exception Handling in Java Java
  • Gautama Buddha life story in Hindi, Buddha's history
    Gautama Buddha life story in Hindi, Buddha’s history Biography
  • What is Mutual Fund?
    What is Mutual Fund? Important
  • What is Internship? How to get Internship?
    What is Internship and how to get Internship? Important
  • What is Agriculture
    Agriculture (कृषि) से जुड़े महत्वपूर्ण प्रश्न और उत्तर Important
  • Binary search in Data structures In C (Recursive and Iterative)
    Binary search algorithm in C, Recursive, Iterative, examples Data Structure
  • Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth
    Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth Biography
  • Java Tutorial
  • Servlet Tutorial
  • JSP Tutorial
  • Maven Tutorial
  • HTML Tutorial
  • Programs
  • Hindi/English Grammar
  • Difference Between ... and ...
  • HR Interview
  • Important Articles

Write to Us:
geekcer.code@gmail.com

  • About Us
  • Privacy and Policy
  • Disclaimer
  • Contact Us
  • Sitemap

Copyright © GeekCer 2022 All Rights reserved