Java Basics Exercises Tutorial

Java Basics Exercises tutorial will help you understand the basic of Java programming language including its definition, features, keywords and data types. Java programming language has become a widely used language across the world.

Java Basics Exercises Tutorial

Java Basics Exercises tutorial will help you understand the basic of Java programming language including its definition, features, keywords and data types. Java programming language has become a widely used language across the world.

Java Basics Exercises Tutorial


Java Basics exercises tutorials teach you about the basic of the Java language that includes its definition, feature, code, keywords, etc.

Definition:

Java is a programming language that is used widely by the programmers across the world to develop applications and softwares for mobile, desktop and tablet. Java has evolved from C and C++ but has since then become better with more code and flexibility than these languages. Business intranet application, e-business software, computing functions etc use the language.

To run Java , a device needs Java Runtime Environment (JRE) that consists of Java Virtual Machine (JVM), Java classes and Java libraries. Most of the web browser today has JRE support.

Features:

  1. Java is Portable or Platform Independent: Portability and Platform independent, both have the same meaning. Java compiles the code in bytecode and JRE executes this bytecode hence it can be compiled anywhere and can be run anywhere. This feature is known as WORA (Write Once Run Anywhere)
  2. Java is an Object Oriented language: This means that no coding can be carried out outside the class definition and a class library is available.
  3. Java language is considered secure when compared to other languages. It is quite difficult to write code and viruses in the language.
  4. There are several features in Java that saves the code written in Java to crash.
  5. Java programming language has automatic garbage collection that deletes the object that are not in use and frees the resources.
  6. Multithreading is allowed in Java in which two or more threads runs simultaneously saving time.
  7. Java language has built-in Networking.

Keywords:

In Java, keywords are used in datatypes, methods, class declaration, etc. Keywords are reserved words that come along with JDK (Java Development kit).

Some of the keywords in Java are:

  • abstract
  • assert
  • boolean
  • break
  • byte
  • case
  • catch
  • char
  • class
  • double
  • else
  • final
  • float
  • for
  • goto
  • if
  • package
  • package
  • package

Data types:

There are two types of data types in Java:

  • Primitive Data type: Primitive Data types are pre defined by the compiler JVM (Java Virtual Machine). Primitive Data types are int, char, float, double, boolean, short, byte, long, string.
  • Non- Primitive Data type: Non- Primitive Data type also known as reference type that has object and class.