In this post, you will learn all important aspects of Java.

Key things to note about Java are –

  1. It’s an object oriented language.
  2. Everything is Class and Object in Java.
  3. Class, Interface and Enum names should start with Upper Case letter.
  4. Package names should be in lower case.
  5. Method names should start with lower case letter and each subsequent word should start in Capital letter – for example setMarks()
  6. All Java statements end with semi-colon (;).
  7. Single line Comments can be marked using // . For multi-line comments you need to use /* ………………*/

Keywords in Java

Here is the list of Keywords in Java.

  1. Data types – int, float, byte, char, double, boolean, long, short
  2. Access Modifiers – public, private, protected
  3. Object Oriented – class, Object, interface, enum, extends, implements, import, instanceof, new, native, package, super, this
  4. Other modifiers – static, abstract, strictfp, synchronized, transient, volatile,const, final
  5. Constructs – break, case, continue, default, do, else, if, for, goto, switch, while
  6. Exception related – catch, finally, throw, throws, try
  7. Others – void, false, null, true, false, assert, return

Operators in Java

Here is the list of Operators in Java.

  1. Arithmetic operators +, -, /, *, %, ++, —
  2. Logical Operators  ||, &&, !
  3. Relational Operators  <. >, ==, <=, >=, !=
  4. Bitwise Operators &, |, ^, ~, <<, >>
  5. Assignment Operators =, +=, -=, *=, /=, %=, <<=, >>=, &=, |=, ^=
  6. Conditional operator ?:

Operator precedence – When calculating the mathematical expressions, Java uses operator precedence rule to calculate the final value of the expression.

For example – * operator has high precedence over – operator.

x = 5-2*9

Result of above expression would be 13 and not 27. If you want to override this rule, you can use parenthesis ().

x = (5-2) * 9

Result of above expression would be 27 as everything inside parenthesis is evaluated first.

Identifiers in Java

Identifiers are nothing but the names given to variables, methods, classes, interfaces etc. Here are the rules to define the identifiers in Java.

  1. It should start with letter, _ or $
  2. It can not contain any other special character like +, &, / etc
  3. It should not have spaces in it

Web development and Automation testing

solutions delivered!!