Submitted by GeePee on Tuesday, June 16, 2015 - 23:12.
This page will talk about Java keywords including Return, Public, Private, Static and Case.
What are keywords?
The keywords in Java are used to serve a certain purpose (depending on which keyword is used). Not all keywords are used in the same places and some are bound to certain statements.
The only thing these keywords have in common is that when they are used, they must be in complete lower case. Any upper-case letters will cause the keyword to void.
I have already created a tutorial dedicated to the use of the return keyword and so I recommend you go and read that one separately. In short, this keyword is used in a method to send a value back to the position of calling the method.
Public or Private?
Public and Private can both be used in the same place, but only one may be chosen. These keywords are used to select the publicity of a certain method or variable. If a method or variable is public, the method or variable in question may be used from any other class or package which imports the containing class. If a method or variable is private, it may only be accessed from the same class it is contained in.
A static keyword can be used in conjunction with a public or private keyword. If a method or variable is static it means there is only one instance of that particular method or variable, and so static can not be used in a Object Oriented Programming class.
The case keyword is used in a Switch statement and is used to state a certain condition of the Switch statement. For example; a switch statement on the integer "i", the case for when i equals 1 would be "case 1:".
There are many other keywords in Java, all of which serve a purpose, but these are the most commonly used ones.