Java Face question 02

Source: Internet
Author: User
JavaBasic1. Where Java is different from other languages

A: The biggest feature of Java is its platform independence, the Java compiler compiled Java source code into bytecode and then the JVM is responsible for interpreting execution, for the world's most popular platform has its corresponding Jvm,java bytecode can be run on a platform with JVM support, Other languages often need to compile specific libraries for specific platforms.

2. Why is Java written once, running everywhere

A: You can write Java code on Windows and compile it in Windows. Classes and jar files obtained from Windows can be run in a UNIX environment, truly cross-platform. All of this portability is behind Java bytecode. The bytecode generated by the Java compiler can be interpreted by any JVM. As a result, it's easier to write Java programs that can run on almost any platform. The Java compiler is responsible for compiling, and the JVM is responsible for interpreting execution.

3. How the class loader works in Java

A: In Java, the class loader is used to load class files, which can be obtained from a specified physical location, such as a file system, or a network location.

There are three main ways of doing this:

  1. Bootstrap ClassLoader This is the first class loader that loads classes from the Rt.jar file.
  2. Extension ClassLoader: (Extension class loader), which loads class files from Jre/lib/ext.
  3. Application ClassLoader: It relies on the classpath to find the location of the class file, and if you specify a jar in the Classpath, the class load will load them.
4. The word main is used in the main method do you think it is a keyword?

A: No, it is a method name, we can take another method of the same name in a class, it is not a keyword.

Java Face question 02

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.