Java is an object-oriented programming language, specially designed to be as independent as possible from the execution platform. Java differs from other programming languages - such as logical and functional programming – in that developers can keep updating completed items rather than starting over. Objects keep your code well organized and allow you to easily modify it when needed.
To understand better, let’s take an example of a car dealer who has several vehicles in his fleet. Each vehicle is an object, but each has different characteristics called classes, which in our example are the different models, engines, body colors, etc. A customer chooses a red van but wants to add a better stereo system. The new van will inherit all the characteristics of the “van” object leaving the programmer the simplified task of modifying only the “stereo” class rather than building the entire vehicle from scratch.
This is what makes Java the ideal platform for mobile phones, website forums, game consoles, and any other applications that require frequent updates and changes. Programs created with Java are “portable” as they are assembled in byte code.
This can be done on any server that has the Java Virtual Machine (JVM). Unlike C ++, objects created with Java do not have to refer to external data. This means that a Java application will continue to run even if the operating system or other external programs crash.
Java is the second most used programming language in the world, right after C and before C ++ and Objective C. It can be downloaded and updated for free. Requires Windows XP or later, Mac OS X 10.7.3 or later, and is compatible with most Linux-based systems.
What is Java: Java is a programming language born in the nineties, and destined to become, in a short time, the most used language of all.
- The first approach to the code
Development environment To write a Java program, we need, first of all, a program that allows us to write text, that is a Text Editor (such as the Note Pad
Class Hello World Declaration of the Hello World class. As we will see, every Java program uses the fundamental concept of class, which will be discussed in detail in the next
- Fundamental components of a program
There are some concepts that are the basis of the knowledge of Java: Classes Objects Members: – Attributes
Basis of Java Language
Laptop with code on a screen hanging over icons programming app, software development, web coding. Isometric conceptual illustration about collaboration work via internet or cloud storage. Remote work.
The concepts of class and object are closely linked. In fact, there are official definitions deriving from the theory of object-oriented programming, which I present below
1. Coding style
The Java language: free schema is case sensitive supports comments supports keywords has rules
2. Primitive data types
Java defines eight primitive data types: integer types:
- double text type:
- char logical
- Boolean type: bo
3. Non-primitive data types
It is already discussed how to start objects from certain classes. We must first declare an object of that class with syntax like this: Class Name
4. Introduction to the standard library
As already mentioned several times, Java has a huge and luxurious standard class library, which is one of the strong points of the language.
An array is a collection of primitive data types, references, or other arrays. Arrays allow you to use a single name to identify a collection consisting of several elements
6. The Javadoc tool
We first mentioned the possibility of generating documentation in HTML format of our classes, on the model of the documentation of the standard Java classes.
7. Basic operators
Below is a deliberately incomplete list of the operators that Java makes available to us. For some of them, the usage is somewhat
- If and While
If construct this condition allows us to make simple decisions based on stored values. At runtime, the Java Virtual Machine tests a Boolean expression, and
- For, do, switch
For construct, we complete the discussion of loops by presenting for and do. They are two loops, equivalent to the while, with particular characteristics. Here is the syntax for the for, just in case.
8. The paradigms of object-oriented programming
What characterizes an object-oriented language is the support it offers to the so-called “object-oriented programming paradigms”, which we list below
Encapsulation is the key to object-oriented programming. Through it, a class manages to acquire characteristics of robustness, independence and reusability.
When to use encapsulation
If we wanted to be brief, the answer to the question of the title of this teaching unit should be “always”. Any class of any
9. Introduction to Java Database Connectivity (JDBC)
In recent years, Sun’s Java programming language was born, developed, and is rapidly establishing it.
JDBC and database access (Part I)
Page 1 of 4 JDBC is an excellent programming interface that allows access to a database from any Java software. JSP pages, as models of Java classes
JDBC and database access (Part II)
Page 2 of 4 A TESTS WITH MYSQL the first test will be carried out using MySQL, a well-known open-source DBMS. First, therefore, you will need to install this software in your mail
JDBC and database access (Part III)
Page 3 of 4 Lets review the operations carried out: <% @ page import = “java.sql. *”%> With this line the contents of the java.sql package are made visible, c
JDBC and database access (Part IV)
Page 4 of 4 A TESTS WITH ACCESS now let’s try a JDBC-ODBC connection, using an Access database. Obviously, to put the experiment into practice, it is necessary
Security (Part I)
Page 1 of 3 Java and Security Just as Java introduces new ideas into programming, Java also introduces new security issues. How to make sure that an object to
Security (Part II)
Page 2 of 3 under the dress … CodeSource and Permissions Policies are relatively simple, they link the code with one or more Permissions in a format that is more or less
Security (Part III)
Page 3 of 3 What Happens During a Security Check? While developers usually don’t care too much about routines used during a Permissions check, understand
Connection Pool Management (Part I)
Page 1 of 2 during the development of applications that access a database, you may have noticed that establishing the connection to the database may also require
Connection Pool Management (Part II)
Page 2 of 2 Step-by-step development of a Connection Pool class in Java Let’s proceed with the development of Java code capable of correctly managing a connection pool. We build in
10. Methods in Java
In the definition of class, when we talk about characteristics, in practice we refer to data (variables and constants), while the term functionality refers to methods. We have.
About us: Codelivly is a platform designed to help newbie developers to find the proper guide and connect to training from basics to advance