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

  • Real life Inspirational Stories in Hindi | Success story in Hindi
    Real life Inspirational Stories in Hindi | Success story in Hindi Biography
  • Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth
    Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth Biography
  • Lanka Kand Summary in Hindi | Ram Vs Ravana | लंका काण्ड
    Lanka Kand Summary in Hindi | Ram Vs Ravana | लंका काण्ड Spiritual
  • World Environment Day in Hindi : Objective, Importance, Theme
    World Environment Day in Hindi : Objective, Importance, Theme General Knowledge
  • Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा
    Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा Festival
  • Nelson Mandela Biography in Hindi | Nelson Mandela Day
    Nelson Mandela Biography in Hindi | Nelson Mandela Day Biography
  • Sunder Kand in Hindi | Hanuman Kand | हनुमान जी का सुंदरकांड
    Sunder Kand in Hindi | Hanuman Kand | हनुमान जी का सुंदरकांड Spiritual
  • Diwali The Festival of Lights
    Diwali 2022, Indian Festival of Lights essay (दिवाली त्योहार पर निबंध, कहानी) Festival

Java Keywords

Posted on August 15, 2021October 11, 2021 By GeekCer Education
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

Stack Vs Heap in Java Stack Vs Heap in Java | Memory Allocation Section in Java Differences
Difference between Comparable and Comparator Difference between Comparable and Comparator Differences
Difference between GenericServlet and HttpServlet Difference between GenericServlet and HttpServlet Differences
Collections in Java Collections in Java Java
Java Comments Java Comments : Types of java comments, Syntax & Examples Java
Object Oriented Programming Object Oriented Programming 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
  • National Farmers Day in Hindi | राष्ट्रीय किसान दिवस पर निबंध | चौधरी चरण सिंह जयंती
  • Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे
  • Unicef day is celebrated on December 11 | Speech on unicef day
  • Indian Navy Day: जल सेना दिवस कब और क्यों मनाया जाता है?
  • P V Sindhu Biography in Hindi, Badminton, State, Caste पी. वी. सिंधु जीवन परिचय, कहानी, राज्य, जाति
  • Draupadi Murmu Biography In Hindi | द्रौपदी मुर्मू की जीवनी
  • Difference between Internet and Intranet
    Difference between Internet and Intranet Differences
  • TCP/IP Model, Full Form, Layers and their Functions
    TCP/IP Model, Full Form, Layers and their Functions Networking
  • Network kya hai (नेटवर्क क्या है)
    Network kya hai (नेटवर्क क्या है) Networking
  • Similarities and difference between OSI and TCP/IP model
    OSI vs TCP/IP Model, Similarities and difference between OSI and TCP/IP model Networking
  • IPv4 Vs IPv6 | Difference between IPv4 and IPv6
    IPv4 Vs IPv6 | Difference between IPv4 and IPv6 Differences
  • OSI Model | 7 Layers of OSI Model in Computer network
    OSI Model | 7 Layers of OSI Model in Computer network, Functions Networking
  • Difference between TCP and UDP
    Difference between TCP and UDP | TCP vs UDP examples Differences
  • 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