Learn Pain Less

HomeOur TeamContact
Java
What are Predefined Keywords in java, why to use them
Pawneshwer Gupta
Pawneshwer Gupta
February 02, 2015
1 min

Table Of Contents

01
Keywords
02
List of Keywords in JAVA :
What are Predefined Keywords in java, why to use them

Keywords

Keywords are some special names which are reserved by JAVA, We can not use that names to create variables,classes or methods. They have their different meanings. for example ”class”, its reserved by JAVA. This keyword is used to create new class but if we try to use that name for our class then its impossible.

for example if we make a class like this example :

class class{
public static void main(String[] args){
System.out.println("Hello");
}
}

and when you try to run this code then you will get below error :

_class.java:1: error: <identifier> expected_

as shown in below screenshot.

java-keyword
java-keyword

List of Keywords in JAVA :

  1. abstract
  2. assert
  3. boolean
  4. break
  5. byte
  6. case
  7. catch
  8. char
  9. class
  10. const
  11. continue
  12. default
  13. do
  14. double
  15. else
  16. enum
  17. extends
  18. final
  19. finally
  20. float
  21. for
  22. goto
  23. if
  24. implements
  25. import
  26. instanceof
  27. int
  28. interface
  29. long
  30. native
  31. new
  32. package
  33. private
  34. protected
  35. public
  36. return
  37. short
  38. static
  39. strictfp
  40. super
  41. switch
  42. synchronized
  43. this
  44. throw
  45. throws
  46. transient
  47. try
  48. void
  49. volatile
  50. while

here is list by categories :

CategoryKeywords
Access modifiersprivate, protected, public
Class, method, variable modifiersabstract, class, extends, final, implements, interface, native, new,static, strictfp, synchronized, transient, volatile
Flow controlbreak, case, continue, default, do, else, for, if, instanceof, return,switch, while
Package controlimport, package
Primitive typesboolean, byte, char, double, float, int, long, short
Error handlingassert, catch, finally, throw, throws, try
Enumerationenum
Otherssuper, this, void
Unusedconst, goto

These are keywords in java, each and every keyword have its special task. for example ’classkeyword is used to create Classes in java. It is impossible to create Class without using ’class’ keyword.

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.

Tags

startkeywordsjava

Share


Pawneshwer Gupta

Pawneshwer Gupta

Software Developer

Pawneshwer Gupta works as a software engineer who is enthusiastic in creating efficient and innovative software solutions.

Expertise

Python
Flutter
Laravel
NodeJS

Social Media

Related Posts

Working with Files, Folders java
Working with Files, Folders java
March 25, 2015
1 min
Learn Pain Less  © 2024, All Rights Reserved.
Crafted with by Prolong Services

Quick Links

Advertise with usAbout UsContact Us

Social Media