In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the entry-level features of Java". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Java is simple
Java is very similar to C++, but much simpler. All the features of the high-level programming language that are not absolutely necessary have been deleted. For example, Java does not have operator overload, header files, preprocessing, pointer operations, structures, unions, multidimensional arrays, templates, and implicit type conversions. If you know a little bit of C, C++ or Pascal, you will soon be able to master Java. Here is a simple JavaHelloWorld program:
Public class HelloInternet
{
Public static void main (String argv [])
{
System.out.println ("Hello Internet!")
}
}
2. Java is object-oriented
Java is an object-oriented programming language. Except for simple types, such as numbers and Boolean operators, most of the Java are objects.
Like any object-oriented language, Java code is organized by class. Each class defines a set of methods that specify the behavior of the object. One class can inherit the behavior of another class. At the root level of a class, it is usually a class object.
Java supports single inheritance class hierarchies. That is, each class can inherit only one other class at a time. Some languages allow multiple inheritance, but this can cause confusion and unnecessarily complicate the language. For example, it is hard to imagine that an object inherits the behavior of two completely different classes.
Java also supports interfaces for summary classes. This allows programmers to define the method of the interface first without having to rush to determine the implementation of the method. A class can implement multiple interfaces, thus having many of the advantages of true multi-inheritance. An object can also implement any number of interfaces. The Java interface is very similar to the IDL interface. It is easy to build an IDLJ compiler. That is to say, Java can be used in CORBA object systems to build distributed object systems. In view of the fact that IDL interfaces and CORBA object systems are used in many computer systems, this compatibility is important.
3. Java is of static type
In a Java program, you must define the type of object (numbers, characters, arrays, and so on) used. This helps programmers find problems quickly, because type errors can be detected when the program is compiled.
However, objects in Java systems also have dynamic types. It is often possible to require an object to be a dynamic type, so programs written by programmers can do different things for different types of objects.
4. Java is compiled
When running a Java program, it is first compiled into byte code. Bytecode is very similar to machine instructions, so Java programs are very efficient. However, bytecode is not specific to a particular machine, so Java programs can be executed on many different computers without recompiling.
The Java source program is compiled into a class file, which is equivalent to the bytecode representation of the program. In a Java class file, all references to methods and instance variables are made by name and distinguished the first time the code is executed. This makes the code more generic, less vulnerable to changes, and still efficient.
5. Java is architecture neutral
The Java language is the same for every computer. For example, simple types are immutable: integers are always 32-bit and long integers are always 64-bit. Curiously, trendy programming languages such as C and C++ are not. Because these languages are defined so freely, each compiler and development environment is different, which makes the migration of programs a nuisance. Porting Java programs is easy and does not require recompilation.
6.Java is sound.
It is impossible for a Java program to cause a computer crash. The Java system carefully examines every access to memory to make sure it is legitimate and does not cause any problems.
However, even Java programs can have errors. If something unexpected happens, the program will not crash and throw away the exception. The program will find such exceptions and deal with them.
Traditional programs can access all the memory of the computer. The program may (unconsciously) modify any value in memory, which can cause problems. Java programs can only access those parts of memory that they are allowed to access, so it is impossible for Java programs to modify values that are not intended to be modified.
7. Java is small
Because Java is designed to run on small computers, its system is relatively small as a programming language. It can run effectively on the PC of RAM above 4MB. The Java translator takes up only a few hundred KB. This translator is reliable for the platform independence and portability of Java.
Because Java is very small, it is ideal for computers with very small memory, such as PCs based on Java, as well as televisions, ovens, telephones and home computers.
Java is multithreaded.
Java programs can execute more than one thread. For example, it can complete a time-consuming calculation in one thread while other threads interact with the user. So the user does not have to stop working and wait for the Java program to complete the time-consuming calculation.
Programming in a multithreaded environment is often difficult because many things can occur at the same time. However, Java provides easy-to-use synchronization features that make programming easier.
Java threads are usually mapped to actual operating system threads, as long as the underlying operating system supports this mapping. Therefore, applications written in Java can be said to be "MP hot". That is to say, if they run on multiprocessor machines, they will perform better.
9. Java can collect useless storage units
Programmers who write software in C and C++ must carefully track the blocks of memory they use. When a block is no longer used, they must let the program release it before it can be used again. In large projects, this can be difficult and often a source of errors and insufficient memory.
In the case of Java, programmers don't have to worry about memory management. The Java system has a built-in program called the garbage Collector, which scans memory and automatically frees blocks of memory that are no longer in use.
10. Java is fast
Java is much more efficient than a typical scripting language, but it is 20 times slower than C. This is acceptable for most applications. In the near future, code generators will be available, which will make Java programs nearly as fast as programs written in C or C++.
11. Java is safe
Java programs do not have pointers, and bytecode programs like this are strong on types, so it may validate Java programs before execution. The validated Java programs are guaranteed not to break through any restrictions of the Java language and can be executed safely. Java bytecode verification is used by Web browsers to ensure that Mini Program is virus-free.
12. Java is extensible
Java programs can be linked to existing libraries written in other languages. This is quite convenient because the type of Java data structure is very similar to that of C #. The biggest problem is that there are only a few multithreaded libraries available.
Java programs can declare that certain methods are internal, and then map these internal methods to the functions defined by the software library, thus dynamically linking to the virtual machine.
This is the end of the content of "what are the entry-level features of Java". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.