• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OCA 8 preparation, keywords in Java

 
Aleksandra Pestova
Ranch Hand
Posts: 36
2
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone at coderanch!

This is my first post here.

First of all I would like to thank Jeanne&Scott for the amazing book "OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808" ! It helps me a lot.

I have a question regarding keywords in Java.

In the book there's a list of all keywords in Java, 53 in total.
I checked Java documentation http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html and it is stated there that
true, false, and null might seem like keywords, but they are actually literals
.

I would like to clarify whether true, false and null are keywords as stated in the book or literals - as in Java documentation.

Thank you very much in advance!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aleksandra,
Welcome to CodeRanch! This is a good question.

For the exam: it doesn't matter. You can't use them as variable or method names.

For learning: We actually say the table is reserved words. Reserved words include keywords and other things you can't use. It is a subtle distinction. The different is keywords do something. Like "if". Whereas reserved words you just can't use as identifiers. For example, true. Or "goto" which doesn't do anything in Java but you still can't use.
 
Aleksandra Pestova
Ranch Hand
Posts: 36
2
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Jeanne!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic