java coding basics

Java Basics

Programming Language Java

Of all programming languages, Java is probably one of the best known: The object-oriented programming language enables platform-independent applications to be developed. No special operating system is required to run the programs, just a software environment: The Java Runtime Environment (JRE) from Sun Microsystems.

Programming paradigms and typing discipline

Java can be classified into multiple paradigms: object-oriented, functional, imperative, generic, reflective and concurrent. A programming paradigm is a complex of concepts, principles and abstractions which define a fundamental style of programming.

The typing discipline of a language is defined by the nature of type constraints and the way they are evaluated and enforced.
Type Strength: strong
Type Expression: manifest
Type Checking: static
Type Safety: safe

Object Orientation

Programs written in Java use objects. Objects are divided into two components, data elements and the associated functions (methods). The contents of data elements represent the state in which an object is currently located. Functions are operations that move a data object from one state to another. The entirety of objects with the same properties is called a class. Object-oriented programming is the compilation of class descriptions, i.e. the description of the data elements that each object of the class contains, as well as the functions that are applicable to each object of the class. These can be reused, for example, as part of a larger program package. Thus, over time, you can create an extensive library (class library) of various objects. A set of libraries for standard tasks (such as input / output or graphics) is supplied with the language.

Imperative Programming

In the imperative programming paradigm (command-oriented paradigm), the source code specifies exactly what the program should do step by step to reach the result. It is specified how a problem is to be solved. An imperative program consists of a sequence of commands, which the computer processes in the given order. In order to dynamically adjust the sequence of commands to be processed, jump commands can be included. Jump commands can be used to switch to any point in the command sequence in order to continue processing there.

Generic Programming

Generic programming is a programming paradigm that allows the use of so-called type variables when implementing classes, interfaces and methods. The type of these variables is represented with the implementation first by placeholders and treated only at the time of the application. A generic data type increases the type security. In addition, it allows the functionality of a class to be applied to different data types.

Functional Programming

Functional programming is all about functions – in Java Methods. Methods cannot be passed or returned directly to other methods. Therefore, these methods are placed in classes and passed as objects. The best way to do this in Java is with lambda expressions. These are used to implement a class with an interface.

Reflective Programming

In programming, reflection means that a program knows its own structure and can therefore modify it.
In object-oriented programming, reflection makes it possible, among other things, to query information about classes or their instances at runtime. The information could be for example the visibility of a method, or the data type of the return value. The reflexive programming is realized by storing meta information in binary code.

Platform Independent

The platform independence / architecture neutrality results from the fact that Java programs are first compiled in neutral byte code. Byte codes are similar to machine instructions, but are not specific to a particular machine. The source codes in Java are compiled into files of the type .class, which contain the program in bytecode. The bytecodes can now run on any platform that supports Java. They are practically interpreted and executed when starting.

Multithreading (Concurrency)

Threads are parallel actions that a program can execute at the same time. This means that one thread can perform a calculation while another thread enables user interaction at the same time. So there are fewer waiting times. Java has easy-to-use synchronization features designed to ease the difficulties of programming such environments.

WordPress Cookie Notice by Real Cookie Banner