How to learn Java programming for beginners

        Java is a simple language. Java was originally modeled after C and C++, minus some potentially confusing features. Pointers, multiple implementation inheritance, and operator overloading are some C/C++ features that are not part of Java. A feature not mandatory in C/C++ but essential to Java is a garbage collection facility that automatically reclaims objects and arrays.

Java is an object-oriented language

        Java's object-oriented focus allows developers to focus on tuning Java to solve problems, rather than forcing us to manipulate problems to meet language constraints. This is different from a structured language like C. For example, Java lets you focus on savings account objects, while C requires you to think separately about savings account state (such as balance) and behavior (such as deposits and withdrawals).

Java is a web-savvy language

        Java's extensive networking library can easily handle Transmission Control Protocol/Internet Protocol (TCP/IP) network protocols, such as HTTP (Hypertext Transfer Protocol) and FTP (File Transfer Protocol), and simplify the task of establishing network connections. In addition, Java programs can access objects over a TCP/IP network via a Uniform Resource Locator (URL) just as easily as they can be accessed from the local file system.

Java is an interpreted language

        At runtime, a Java program is executed indirectly on an underlying platform (such as Windows or Linux) through a virtual machine (which is a software representation of a hypothetical platform) and an associated execution environment. A virtual machine converts a Java program's bytecode (instructions and associated data) into platform-specific instructions by interpreting it. Interpretation is the act of figuring out what a bytecode instruction means, and then choosing an equivalent "canned" platform-specific instruction to perform. The virtual machine then executes those platform-specific instructions.

        Interpretation makes it easier to debug erroneous Java programs because more compile-time information is available at runtime. Interpretation can also speed up development by delaying the linking step between Java program fragments until runtime.

Java is a robust language

        Java programs must be reliable as they are used in consumer and mission-critical applications ranging from Blu-ray players to vehicle navigation or air control systems. Language features that help make Java robust include declarations, repeated type checking at compile time and run time (to prevent version mismatch problems), real arrays with automatic bounds checking, and pointer omission.

        Another aspect of Java's robustness is that loops must be controlled by boolean expressions rather than integer expressions, where 0 is false and nonzero values ​​are true. For example, Java does not allow C-style loops such as while(x)x++; because the loop may not end where expected. Instead, you must explicitly provide a boolean expression, such as while(x!=10)x++; (which means the loop will run until x equals 10).

Java is a safe language

        Java programs are used in networked/distributed environments. Since Java programs can be migrated to and executed on various platforms across the web, it is important to protect those platforms from malicious code that could spread viruses, steal credit card information, or perform other malicious acts. Java language features that support robustness, such as omitting pointers, can be used with security features such as the Java sandbox security model and public-key cryptography. Together, these features prevent viruses and other dangerous code from wreaking havoc on unsuspecting platforms.

        In theory, Java is safe. In practice, various security vulnerabilities have been detected and exploited. So Sun Microsystems at the time and Oracle now continue to release security updates.

Java is an architecture neutral language

        Networks connect platforms with different architectures based on various microprocessors and operating systems. You can't expect Java to generate platform-specific instructions and have those instructions be "understood" by various platforms in the network. Instead, Java generates platform-independent bytecode instructions that are easily interpreted by each platform (via its JVM implementation).

Java is a portable language

        Architecture neutrality facilitates portability. However, Java's portability goes beyond platform-independent bytecode instructions. Consider that integer types cannot vary in size. For example, a 32-bit integer type must always be signed and occupy 32 bits, regardless of where the 32-bit integer is handled (e.g. a platform with 16-bit registers, a platform with 32-bit registers, or a platform using 64-bit registers). Java's libraries also help with portability. When necessary, they provide types that connect Java code with platform-specific functionality in the most portable manner.

Java is a high-performance language

        The level of performance produced by interpretation is usually more than adequate. For very high-performance application scenarios, Java uses just-in-time compilation, which analyzes interpreted bytecode instruction sequences and compiles frequently interpreted instruction sequences into platform-specific instructions. Subsequent attempts to interpret these sequences of bytecode instructions result in the execution of equivalent platform-specific instructions, improving performance.

Java is a multi-threaded language

        To improve the performance of programs that must complete multiple tasks simultaneously, Java supports the concept of threaded execution. For example, a program that manages a graphical user interface (GUI) while waiting for input from a network connection uses another thread to perform the wait, rather than using the default GUI thread for both tasks. This keeps the GUI responsive. Java's synchronization primitives allow threads to communicate data between them safely without corrupting the data.

Java is a dynamic language

        Because the interconnection between program code and libraries occurs dynamically at runtime, there is no need to link them explicitly. Thus, when a program or one of its libraries evolves (for example, for bug fixes or performance improvements), the developer only needs to distribute the updated program or library. While the dynamic behavior results in less code to be distributed when version changes occur, this distribution strategy can also lead to version conflicts. For example, a developer removed a class type from the library, or renamed it. Existing programs that depend on class types will fail when companies distribute updated libraries. To greatly reduce this problem, Java supports an interface type, which is like a contract between two parties.

        Unpacking this definition can tell us a lot about Java. Most importantly, it reveals that Java is both a language and a platform. You will learn more about the components of the Java platform, namely the Java Virtual Machine and the Java Execution Environment, later in this tutorial.

 

Java learning video

Java basics:

Java300 episodes, Java must-have high-quality videos_Learn Java with hands-on diagrams, making learning a kind of enjoyment

Java project:

[Java game project] 1 hour to teach you how to make classic minesweeper games in Java language_Teach you how to develop games

[Java graduation project] OA office system project actual combat_OA employee management system project_java development

Guess you like

Origin blog.csdn.net/java_0000/article/details/125283665