Java Overview Summary

Source: Internet
Author: User

    1. Java source file One "Java" is the extension. The basic component of Java is the class.

    2. A source file can have at most one public class. The number of other classes is unlimited, and if the source file contains a public class, the file name must be named by that class name.

    3. The execution portal for Java applications is the main () method. It has a fixed writing format: public static void Main (string[] args) {}

    4. Java language is strictly case sensitive

    5. The Java method consists of a line of statements, with each statement ";" End.

    6. Curly braces appear in pairs and are indispensable.

    7. What is a GC? Why do you have a GC?

      GC is the meaning of garbage collection, memory processing is a problem for programmers, forget or wrong memory recycling will cause the program or system instability or even crash, Java provides the GC function can automatically monitor whether the object exceeds the scope to achieve the purpose of automatic recovery of memory, The Java language does not provide a realistic way to release allocated memory.

    8. Can a ". Java" and a file contain more than one class (not an inner class)? What are the restrictions?

      OK. If the class name is decorated with public, then the class name is the same as the file name.

    9. What is the rationale behind the garbage collection period? Can the garbage collector reclaim memory right away? Is there any way to proactively notify a virtual machine for garbage collection?

      For FC, when a programmer creates an object, the GC starts to monitor the object's address, size, and usage. Typically, the GC records and manages all the exclusive in the heap in a graph-based manner. In this way, you determine which objects are "accessible" and which objects are "unreachable." When the GC determines that some objects are unreachable, the GC is responsible for reclaiming those memory spaces. OK. Programmers can manually execute System.GC ();

Notifies the GC to run, but the Java language specification does not guarantee that the GC will execute.

10. Here, the something class file is called Otherthing.java

Class Something {

private static void Main (string[] something_to_do) {

System.out.println ("Do something ...");

}

}

This seems pretty obvious.

Answer: Right. No one has ever said that Java's class name must be the same as its file name. However, the public class must have the same name as the file name.


This article is from the "10281302" blog, please be sure to keep this source http://10291302.blog.51cto.com/10281302/1698956

Java Overview Summary

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.