Home » Core Java » Java Operators & Keywords

Java Operators & Keywords

 
Java Operators :: 

Below  are some of the mainly used Java operators.

Operator Type Symbol  Description
Arithmetic Operator + Additive operator (used for adding numbers and  also for String concatenation)
Arithmetic Operator Subtraction operator
Arithmetic Operator * Multiplication operator
Arithmetic Operator / Division operator
Arithmetic Operator % Remainder operator
Assignment Operator  = Simple Assignment Operator
Equality  Operator  == Equal to
Relational Operator  != Not equal to
Relational Operator  >  Greater than
Relational Operator  >=  Greater than or equal to
Relational Operator  <  Less than
Relational Operator  <=  Less than or equal to
Unary Operator  + Unary plus operator; indicates positive value (numbers are positive without  this, however)
Unary Operator  – Unary minus operator; negates an expression
Unary Operator  ++ Increment operator; increments a value by 1
Unary Operator  — Decrement operator; decrements a value by 1
Unary Operator  ! Logical complement operator;inverts the value of a boolean
Conditional Operators  &&  Conditional-AND
Conditional Operators  ||   Conditional-OR
Conditional Operators  ?: Ternary (shorthand for if-then-else statement)
Type Comparison Operator  instanceof compares an object to a specified type
Object Creation Operator  new  creates object of class
 nvocation Operator  () invokes method 
Access Operator  . access member  variable or method of object or class 
Access Operator  [ ] access array element
Bitwise and Bit Shift Operators  ~  Unary bitwise complement
Bitwise and Bit Shift Operators  <<  Signed left shift
 Bitwise and Bit Shift Operators  >> Signed right shift
Bitwise and Bit Shift Operators  >>> Unsigned right shift
Bitwise and Bit Shift Operators  & Bitwise AND
Bitwise and Bit Shift Operators  ^  Bitwise exclusive OR

 

Bitwise and Bit Shift Operators | Bitwise inclusive OR

Java KeyWords ::
Below is a list of keywords in the Java programming language. 

abstract continue for new switch
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while
Keyword Description 
abstract used with  class, method, or methods inside an interface
assert Tests the truth of a condition 
boolean Indicates that a value is either true or false.
break Jumps out of a loop or switch.
byte Indicates that a value is an 8-bit whole number.
case possibilities  in a switch statement.
catch clause to catch exception
char Indicates that a value is a character 
class A blueprint for an object.
continue Re-execution of a loop
default not particular to any case in a switch statement.
do Computes or executes some statements over and over again 
double Indicates that a value is a 64-bit number with one or more digits after the decimal point.
else executed when if statement is not true.
enum enum type is a special data type that enables for a variable to be a set of predefined constants.
extends using this keyword sub class overrides methods of super class
final Indicates that a variable’s value cannot be changed, a class’s functionality cannot be extended and a method cannot be overridden.
finally The finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs.
float Indicates that a value is a 32-bit number with one or more digits after the decimal point.
for Computes or executes some statements over and over again 
goto Can’t use this word in a Java program. 
if Checks whether a condition is true.
implements Allow classes to use  methods and variable of  interface.
import Enables classes to import  package of a jar.
instanceof Checks if  a certain object comes from a certain class.
int Indicates that a value is a 32-bit whole number.
interface An  100% abstract class type
long Indicates that a value is a 64-bit whole number.
native Enables the programmer to use code that was written in another language
new Creates an object of a class.
package A namespace to group logically related definitions.
private Indicates that a variable or method can be used only within a certain class.
protected Indicates that a variable or method can be used in subclasses from another package.
public Indicates that a variable, class, or method can be used by any other Java code.
return Ends execution of a method and possibly returns a value to the calling code.
short Indicates that a value is a 16-bit whole number.
static Indicates that a variable or method is a class level property
strictfp represent extra large or extra small numbers 
super Refers to the superclass of the code in which the wordsuper appears.
switch block similar to if else  with break and  default facility
synchronized makes method or block  thread safe
this self-reference or  refers to the current class’s object 
throw Creates a new exception object 
throws Indicates that a method throws some exceptions.
transient Indicates that, if and when an object is serialized, a variable’s value doesn’t need to be stored.
try try clause to execute some statements which may throw exception
void Indicates that a method does not return a value.
volatile Variable value is read from main memory always
while Computed or executes  some statements over and over again 

These keywords can not be used as identifiers in java programs. The keywords const and goto are no longer used in java,still  we can not use them as identifier in  our programs. true,false, and null are not keywords, but  literals; we cannot use them as identifiers in your programs.

 


Leave a comment

Your email address will not be published. Required fields are marked *

19 − six =