Home Java javaTutorial Java for Beginners - Introduction: Introduction, Fundamentals and Practice #Cap1

Java for Beginners - Introduction: Introduction, Fundamentals and Practice #Cap1

Jan 11, 2025 pm 08:03 PM

Java Para Iniciantes - Introdução: Introdução, Fundamentos e Prática #Cap1

  • Important Information from Chapter 1
    • Introduction to Java and its Importance
  • Java Evolution
  • Key Features
  • Why choose Java in 2024?
  • Contributions
  • Bytecode
  • POO
  • Data Types
  • Conversions and Good Language Practices
  • Repeating Blocks and Structures
  • Identifiers
  • Libraries
  • Treating syntax errors
  • My first programs

Important Information from Chapter 1

Created by Sun Microsystems in 1995.

Popularized the "Write Once, Run Anywhere" (WORA) concept.

1. Introduction to Java and its Importance

History and Motivation of Java: The chapter covers the creation of Java, its origins in 1995, and the reasons why it has become such a popular and reliable language, especially in enterprise systems, mobile devices and IoT.

Java is a robust, high-level, object-oriented programming language widely used in the development of enterprise applications, enterprise systems, web, and mobile applications. Developed by Sun Microsystems (now owned by Oracle), it is known for its portability, security, and strong support for multithreading. Java is highly scalable and has a vast ecosystem of libraries, frameworks such as Spring and Hibernate, as well as integration tools such as Maven and Gradle. The language is also used in corporate environments for its efficient processing capabilities and reliability in native execution. Additionally, Java supports different architectures and operating systems, making it a popular choice for developing robust and scalable software.

JAVA EVOLUTION

A summary of the main features from the beginning!

# Java 1.0 (1995) – O Começo ?
- Write Once, Run Anywhere (WORA)
- Suporte a:
  - Applets
  - Multithreading básico

# Java 1.2 (1998) – Java 2 e a Revolução ?
- Swing: Nova biblioteca para GUIs
- Collections Framework: Estruturas como ArrayList e HashMap
- JIT Compiler: Melhor desempenho

# Java 1.4 (2002) – Robustez e Desempenho ?
- Assertions para depuração
- Pacote java.nio: Melhorias no I/O
- Expressões Regulares (java.util.regex)

# Java 5 (2004) – Modernização da Linguagem ?
- Generics: List<String> 
- Enhanced for-loop: for (int i : array)
- Annotations: @Override
- Enums e Varargs
- Concurrent API: Melhor suporte a threads

# Java 6 (2006) – Refinamentos ?️
- Melhor desempenho da JVM
- Compiler API (javax.tools)
- Java Scripting API: Integração com JavaScript

# Java 7 (2011) – Simplificação e Eficiência ⚡
- Try-with-resources: Gerenciamento automático de recursos
- Switch com Strings
- Multi-catch em exceções
- NIO.2: Melhor manipulação de arquivos

# Java 8 (2014) – Programação Funcional ?
- Lambdas: (x) -> x * 2
- Streams API: Processamento declarativo de coleções
- Optional: Lidar com null de forma segura
- API de Data e Hora (java.time)
- Default Methods: Métodos padrão em interfaces

# Java 9 (2017) – Modularização ?
- JPMS: Java Platform Module System
- JShell: REPL para experimentaçã
Copy after login
Copy after login

Key Features:

  • Portability (Write Once, Run Anywhere - WORA).
  • Strong typing and security.
  • Support multithreading and object-oriented programming.

Why choose Java in 2024?

Comparison between Java and Python.
| Feature | Java | Python |
|----------------------|-------------------------- ----|------------------------------|
| Paradigm | Object Oriented | Multiparadigm |
| Syntax Style| Stricter syntax | More flexible syntax |
| Execution Speed | Fast for native execution | Slightly slower than Java running natively |
| Compatibility | Very good, especially for corporate applications | Good for web applications and scripting |
| Community | Large, robust community | Active and broad community |
| Ecosystem | Large ecosystem | Extensive ecosystem with frameworks, libraries and modules |
| Corporate Use | Strongly used in companies | Widely used in data science, machine learning, web development |
| Application Types| Corporate applications, backend, embedded systems | Web, data science, automation, scripting |
| Performance | Better native performance | Better performance for rapid development and prototyping |
| Memory Requirement| Increased memory usage | Lower memory usage |
| Market Entries| Launched in 1995 | Launched in 1991 |
| Choice for Web | Widely used for backend | Popular for web development |
| Ease of Learning| A little more difficult for beginners | Easier for beginners |
| Security | Good, with several security mechanisms | Good, but in web applications it may require extra care |
| Multithreading | Robust support for multithreading | Support for multithreading, but may be less efficient in some cases |

Contributions

  • Introduction of bytecode for portability.
  • Advancement of Object Oriented Programming (OOP) and security.

Bytecode

- Bytecode: intermediate code executed by the JVM.

POO

  • OOP (Object Oriented Programming): a programming paradigm that organizes code around objects.
    • THE four pillars:
      • ABSTRACTION
      • INHERITANCE
      • POLYMORPHISM
      • ENCAPSULATION

Data Types

  • Primitive types like int, double, char.
# Java 1.0 (1995) – O Começo ?
- Write Once, Run Anywhere (WORA)
- Suporte a:
  - Applets
  - Multithreading básico

# Java 1.2 (1998) – Java 2 e a Revolução ?
- Swing: Nova biblioteca para GUIs
- Collections Framework: Estruturas como ArrayList e HashMap
- JIT Compiler: Melhor desempenho

# Java 1.4 (2002) – Robustez e Desempenho ?
- Assertions para depuração
- Pacote java.nio: Melhorias no I/O
- Expressões Regulares (java.util.regex)

# Java 5 (2004) – Modernização da Linguagem ?
- Generics: List<String> 
- Enhanced for-loop: for (int i : array)
- Annotations: @Override
- Enums e Varargs
- Concurrent API: Melhor suporte a threads

# Java 6 (2006) – Refinamentos ?️
- Melhor desempenho da JVM
- Compiler API (javax.tools)
- Java Scripting API: Integração com JavaScript

# Java 7 (2011) – Simplificação e Eficiência ⚡
- Try-with-resources: Gerenciamento automático de recursos
- Switch com Strings
- Multi-catch em exceções
- NIO.2: Melhor manipulação de arquivos

# Java 8 (2014) – Programação Funcional ?
- Lambdas: (x) -> x * 2
- Streams API: Processamento declarativo de coleções
- Optional: Lidar com null de forma segura
- API de Data e Hora (java.time)
- Default Methods: Métodos padrão em interfaces

# Java 9 (2017) – Modularização ?
- JPMS: Java Platform Module System
- JShell: REPL para experimentaçã
Copy after login
Copy after login
  • Specific objects and value ranges.

Conversions and Good Language Practices

  • Implicit or explicit conversions (casting).
  • Clear names and use of comments for readability.

Repeating Blocks and Structures

  • Blocks organize sections with {}; Structures include for, while, do-while.
  • Essentials for condition-based repetitive execution.

Identifiers

  • Name variables, methods and classes.
  • Follow conventions (e.g. camelCase for variables, PascalCase for classes).

Libraries

  • Includes standard libraries like java.util and java.io.
  • Code reuse and complexity reduction.

Treating syntax errors

  • Common mistakes like forgetting; or {}.
  • Error messages help with debugging.
  • Try Catch: is a programming structure that allows the programmer to control the flow of code execution in unforeseen situations

    public class TiposDeDadosExample {
        public static void main(String[] args) {
            int numero = 10;       // Tipo inteiro
            double pi = 3.14159;   // Tipo decimal
            char letra = 'A';      // Tipo caractere
            boolean verdadeiro = true;  // Tipo booleano
    
            System.out.println("Número: " + numero);
            System.out.println("Valor de pi: " + pi);
            System.out.println("Letra: " + letra);
            System.out.println("Valor booleano: " + verdadeiro);
        }
    }
    
    Copy after login

My first programs

  • Basic examples like "Hello, World!" for introduction. > Hello World
try {
int result = 10 / 0;  // Possível erro de execução
} catch (ArithmeticException e) {
    System.out.println("Erro: " + e.getMessage());
}
Copy after login
  • Use of the main method and execution through the terminal.
  • Class Example of an Object in Java
public class OláMundo {
    public static void main(String[] args) {
        System.out.println("Olá, Mundo!");
    }
}
Copy after login

GOOD STUDIES! Enjoy the journey.

Previous Topic

  • JAVA FOR BEGINNERS: General Guidelines and Environment Settings

Next Topic

  • JAVA FOR BEGINNERS: CACP 2

The above is the detailed content of Java for Beginners - Introduction: Introduction, Fundamentals and Practice #Cap1. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Java's classloading mechanism work, including different classloaders and their delegation models? How does Java's classloading mechanism work, including different classloaders and their delegation models? Mar 17, 2025 pm 05:35 PM

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache? How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache? Mar 17, 2025 pm 05:44 PM

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading? How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading? Mar 17, 2025 pm 05:43 PM

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution? How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution? Mar 17, 2025 pm 05:46 PM

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management? How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management? Mar 17, 2025 pm 05:45 PM

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

See all articles