Created by Sun Microsystems in 1995.
Popularized the "Write Once, Run Anywhere" (WORA) concept.
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.
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çã
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 |
# 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çã
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); } }
try { int result = 10 / 0; // Possível erro de execução } catch (ArithmeticException e) { System.out.println("Erro: " + e.getMessage()); }
public class OláMundo { public static void main(String[] args) { System.out.println("Olá, Mundo!"); } }
GOOD STUDIES! Enjoy the journey.
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!