Home  >  Article  >  Java  >  JAVA programming basics

JAVA programming basics

PHPz
PHPzforward
2023-08-29 14:41:171560browse

JAVA programming basics

JAVA is a powerful, portable and highly secure programming language created by James Gosling in 1991 at a company called Sun Microsystems, Inc. Its official name is OAK, which was renamed JAVA by Sun Microsystems in 1995. The company has been acquired by Oracle Corporation. It is a general-purpose programming language and an object-oriented programming language. JAVA is a modern widely used programming language. It contains various protection measures designed to prevent program runtime crashes such as garbage collection - invalid addresses, array and string bounds checks, no pointer arithmetic, exceptions and interfaces that do not run to incorrect method addresses.

JAVA version

The functions of JAVA vary from version to version. JAVA has three different forms or versions -

Java Standard Edition (JSE)

It is a computer platform that allows us to run programs. It can be used to create and distribute portable code servers and desktop setups. It uses JAVA as its main programming language. It belongs to the JAVA software platform family.

It provides all libraries and APIs, including java.lang, java.net, java.math, java.util, java.io, etc.

Java Enterprise Edition (JEE)

This is a collection of requirements surrounding Java SE (Standard Edition). It is used for making large programs that run on servers and handle large amounts of traffic and complex situations.

Java EE is mainly used in e-commerce, accounting, financial transaction systems and other fields

The translation result of

Java Micro Edition (JME)

is:

Java Micro Edition (JME)

It is used for computing applications in small devices such as boxes, mobile phones and home appliances. It is an object-oriented version. It has great security and built-in protocols.

Apps created this way are portable and can also take advantage of the device's native capabilities.

Types of JAVA applications

Java is the most popular programming language, so it has countless applications. Here are some of the applications:

Enterprise Applications

Java is the first choice for developers to create applications. It is a popular platform with various features such as providing APIs and scripting runtime environment. Also includes web services and applications. It is widely used by banking, finance and accounting departments.

Simply put, it is an application distributed in an environment called an enterprise application

Web Application

It is used to make web applications, and is used by web applications. It provides extensive support to developers for creating web applications. Any type of application can be created with these technologies. It consists of simple coding and high security.

Used to create applications for education, social security, insurance, health departments, small communities, etc.

Mobile App

It is considered the official program for creating mobile applications. It works with programs like Android Studio and Kotlin. Its operation relies on the Java Virtual Machine (JVM), while Android runs class files on the Dalvik Virtual Machine (DVM).

This depends on the concept of object-oriented programming. These files are assembled into Android application packages (APKs).

Game Application

It has the support of open source 3D engine. It is a widely used application in the modern era. It is considered a programming language mainly used for gaming applications.

It is used for creating gaming applications. It consists of long coding and takes time, and lacks garbage collection, but this problem can be solved by using the version of this application.

JAVA Platform

The Java platform is a set of tools that can help us easily create various applications and provide high-security services. These applications use the Java programming language to create code to run the application efficiently.

Much of the Java platform has been developed to ensure that Java functions can run equally without any difficulty. It is a collection of libraries, compilers, virtual machines, and all other components.

It also provides additional libraries when the program needs them. It consists of Java development kit, Java language compiler, Java runtime environment, just-in-time compiler, etc.

Features of JAVA

Java is a commonly used programming language used to create different types of applications. Here is a list of some of these applications:

  • Direct and well known

Java is an easy language to understand, create and learn. It consists of clear, concise and basic syntax. Java does not provide pointer overloading or operator overloading.

  • Object-oriented

It consists of at least one class and object. It provides everything as an object, so it contains some data and behavior

  • powerful

It uses garbage collection as a powerful management system. The way it handles and exceptions makes it more efficient and robust, helping developers create applications easily.

  • Safety

It runs without explicit programs in a virtual machine, making it a highly secure programming language.

  • Platform independent

Java provides platform-independent functionality to its users. It thus offers the promise that code written in Java can run on any machine.

OOP (Object-Oriented Programming System)

By breaking a large problem into smaller objects, it can be solved using an object-oriented programming system. In object-oriented programming, we use objects and classes to develop programs. Objects make program development easier.

The Chinese translation of

Class

is:

Class

It acts as a prototype or template for the data members and methods of the containing object. It is an instance of an object. It is used to define class objects.

grammar

class ClassName{
   // class body
}
The translation of

Object

is:

Object

An object has unique identity, behavior and properties. It is used to define object classes. The state of an object can be defined by data fields and their values.

grammar

ClassName object = new ClassName();

abstract

Abstraction is a unique technique used to hide unnecessary information in a program. Used to define abstract classes in programs.

Syntax of abstract classes

abstract class A{}

Syntax of abstract methods

abstract void printStatus();// no method body and abstract

Encapsulation

It is used to combine data and functions into a form or entity. A Java bean is a fully encapsulated class.

grammar

<Access_Modifier>class<Class_Name{
   private<Data_Members>;
   private<Data_Methods>;
}

inherit

It is used to expand keywords to create inheritance. We can get all the features of other classes through this mechanism.

grammar

class Subclass-name extends Superclass-name {
   // methods and fields
}

Polymorphism

It manifests itself in many ways. Simply put, we can perform an action in multiple ways, which is polymorphism.

grammar

class A{}
Class B extends A{}

in conclusion

JAVA is an object-oriented programming language used to develop different types of applications. It has three main versions, namely Java Standard Edition, Java Enterprise Edition and Java Micro Edition. Java is an easy-to-understand language that provides developers with high-security options. It is also a platform independent language.

The above is the detailed content of JAVA programming basics. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete