10 Core Java Concepts You Should Learn When Getting Started

Posted on

Java is a programming language that helps you write software for many platforms. Whether you are writing a GUI program with a desktop interface, or developing server-side software, or a mobile application using Android, learning Java will serve you well. Here are some core Java concepts to help you get started.

1. The Development Cycle (Building Java Software)

For any kind of program, Java code is written in Java source files which are text files with the extension .java. These source files are compiled using a Java compiler into Java class files. The class files are then assembled into ZIP archives called JAR files. These JAR files are provided to a Java Virtual Machine for execution, which begins executing a main()program within a specified class. computer science computer science computer science

2. Variables

Fundamental to every program (in any language) is the concept of a variable. A variable is a named entity within a program that stores a value. A variable: computer science computer science computer science computer science

  • Has a begin-end lifecycle.
  • May be stored and retrieved from external storage.
  • May have its value changed.
  • Is used in computation. computer science computer science computer science computer science

As an example, let us say you are computing the area of a circle. You would then need to store the radius of the circle in a variable (named, say radius) and use it subsequently to compute the area. Check out the sample code below.

static private double computeArea(double radius) {
  return Math.PI * radius * radius;
}

3. Types

Each variable within a Java program has a type. The type could be a primitive such as a number (radius in the above example has a type of double), a built-in class such a string, or a user-defined class.

The type could be any of the following: computer science computer science computer science computer science

  • A primitive type: A char (for character), a byte (for a single 8-bit value), an int (for 32-bit integer), a short (for a 16-bit integer), a long (for a 64-bit integer), a float (single-precision floating point number) or a double (double-precision floating point number).
  • A built-in Java class: For example, String is a built-in Java class used for storing and manipulating strings.
  • A user-defined class: To represent more complex types, users can define their own classes (explained in detail below). computer science computer science computer science computer science computer science
Prev1 of 4Next

Leave a Reply

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