Reserved words in java

Reserved words in java

Reserved words are keywords that the language uses to determine the properties of something. For example all of the datatypes, static , void, and abstract are reserved words. So while you can say put these words in a string, you can’t make the name of a variable, method, constructor or anything similar into one. They are also split into keywords and literals( like true and false). The list of them and a short description of what they do(from what I know) is below. I may have missed some since there is a lot and some I have never used. They are also all lowercase I am just to lazy to go and correct all of it.

Abstract- used in a method or class declaration and stops either from being used to make instances

Assert- used with assertion statements( whatever those are)

Boolean- a datatypes that uses true and false as values

Break- used to jump out of one set of parenthesis with if and switch statments

Byte- primitive datatypes can hold -128 to 127

Case- used in switch statments

Catch-used when looking for errors along with try

Char- datatypes where it’s a single letter that is given a number value

Class- used with declaring classes

Const- I don’t think it’s really used

Continue- used in a loop to jump to the next iteration of a loop

Default-declares default values and allows interface to provide the default of a method

Do- used in do while

Double- dataype to use for fractions and decimals Max and min is 17 followed by 307 zeros

Else- used in if else statments

Enum-dataype that can hold constants methods and more(I’ve never used this one either)

Extends- used when making a subclass

False-boolean dataype value

Final- used when making constants

Finally-follows a catch or try used to do things like ( I don’t really remember doing this)

Float- datatype for numbers the range is (2 to the-63) to ((2 to the 63)-1)

For- used in for loops

Goto- not used really

If- if statements

Implements- used when making a class inherit a interface

Import- used in import statement which are used to take in Java libraries

Instanceof -used to test if variable is of a specific type returns true or false( never had to use it)

Int- datatype USD with integer vslues

Interface- used when declaring interfaces

Long- another datatype got numbers min is 0 max is (2 to the 64) -1

Native- allows for Java to be called by other languages( I never had to do this)

New- used to initiate a new instance so like when declaring objects

Null- used to make sure there is actually a valid reference to a object

Package- used to group classes together

Private- used to make sure outside classes can’t access something( except for classes in the same package I think)

Protected- similar to private but allows for subclasses and package classes to use it ( I didn’t know this existed)

Public- the opposite of private

Return- used in methods to return a value to where the method was called

Short- datatype for numbers min -32,768 max 32,767

Static- used to make something apply to all instances

Strictfp- it supposedly restricts decimal calculations (what??????)

Super- used to call superclasses stuff

Switch- switch statement

Synchronized- prevents multiple pieces of code from accessing a certain piece of code at the same time( I never used it , but most of my programs it wouldn’t be a issue in the first place. My programs are too simple.)

this- used to reference current object

Throw- used to cause exeptions

Throws-used to list exeptions( I don’t do much with exeptions)

Transient- marks a variable to not be serialized, so the variable won’t be saved in a particular file ( umm I never used it but I googled it so …)

True- Boolean dataype value

Try- used with exeptions to make sure they don’t crash your program

Void- used to signify that there is no return in a method

Volatile- makes a variable stored in main memory ( so it’s ” thread-safe” apparently)

While – used on whole and do-while loops