-
Java source file One "Java" is the extension. The basic component of Java is the class.
-
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.
-
The execution portal for Java applications is the main () method. It has a fixed writing format: public static void Main (string[] args) {}
-
Java language is strictly case sensitive
-
The Java method consists of a line of statements, with each statement ";" End.
-
Curly braces appear in pairs and are indispensable.
-
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.
-
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.
-
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