DEV Community

KamauRuth
KamauRuth

Posted on

GETTING STARTED WITH JAVA.

What is java?

Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
Java is a platform for computer language programming that Sun Microsystems initially introduced in 1995. Java is a computer language created for the Internet era. Without Java installed, many programs and websites won't function, and new ones are being developed every day. Java is quick, secure, and reliable. Java is used on a variety of devices, including cell phones with Internet access, game consoles, and scientific supercomputers.

One must be familiar with these popular Java terminology before studying the language.

  1. Java Virtual Machine (JVM): JVM is the common name for this. A program's execution is divided into three stages. The program is written, compiled, and executed.

A Java programmer, such as you and I, writes programs.
The JAVAC compiler, a primary Java compiler included in the Java development kit (JDK), performs the compilation. It produces bytecode as an output and accepts a Java program as input.
A program's JVM runs the bytecode produced by the compiler during the Running phase.

  1. When learning about bytecode and the JVM, we used the phrase "Java Development Kit" (JDK). Therefore, as implied by the name, it is a full Java development kit that comes with everything such as a compiler, Java Runtime Environment (JRE), java debuggers, java manuals, etc. We need to install JDK on our computer in order to write, compile, and run the java program for it to work

The next phase in the implementation of a Java application software is necessary. They consist of:

  1. Making the program
  2. Compiling the software
  3. Using the application

Keep in mind that the Java Development Kit (JDK) needs to be correctly installed on our system and that the path will be defined before we start writing the application.
• Designing a Program
An IDE (NetBeans) or text editor (Notepad) can be used to construct programs.

** class Test {
public static void main(String []args)
{
System.out.println(“My First Java Program.”);
}
};**

File -> Save -> d:\Test.java

• Compiling the program.
Running the Java compiler (javac) on "command prompt" with the source file's name will allow us to compile the program.

If everything goes according to plan, the "javac" compiler generates a file called "Test.class" that contains the program's byte code.

•Running the program.
To run a program, we must use the Java Interpreter.

Main Features of Java

1. Platform Independent: The JVM runs the bytecode that the compiler created after converting the source code to bytes. This means that if we develop a program on Windows, we can run it on Linux, and vice versa. This bytecode can run on any platform, including Windows, Linux, and macOS. Although each operating system uses a distinct JVM, after the bytecode is executed, all operating systems yield the same results. Java is a platform-independent language for this reason.

2. Object-Oriented Programming Language: Object-oriented programming organizes the program in terms of a collection of objects, each of which represents an instance of the class.

There are four central ideas in object-oriented programming:

  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Encapsulation.

3. High Performance: Java's architecture is designed to minimize runtime overhead, and in some cases, the language uses a Just In Time (JIT) compiler, which only compiles the methods that are actually called, resulting in faster application execution.

4. **Dynamic flexibility:** Because Java is entirely object-oriented, we have the freedom to add classes, modify the methods of existing classes, or even build entirely new classes by using sub-classes. Java even allows native methods, which are functions created in languages other than Java, such as C and C++.

5. Portable: As we know, java code written on one machine can be run on another machine. The platform-independent feature of java in which its platform-independent bytecode can be taken to any platform for execution makes java portable.

6. Java offers functionality for multithreading. It is a Java feature that enables the simultaneous execution of two or more software components for optimal CPU efficiency.

Top comments (0)