Java Learning Guide Learning notes

Source: Internet
Author: User

1, Java is a statically typed, dynamically bound language. Specifically, each object is a good type that is determined at compile time. At the same time, you can check what an object is at run time.

2, in Java except for the basic numeric types, all objects in Java are accessed by reference.

3, same as C + +, different instances of the class data are different, but the methods are the same.

4, all instance variables are set to the default value of 0, false, or null. If you use an object that has not been initialized, you will cause a run-time error.

5, when you run Java/javac on the command line, you need to classpath the project. What is Project Classpath, Classpath is the current directory if there is no package statement in the code. If there is a package statement, the root directory is moved from directory to package. If you specify a different output directory through java-d, you also need to specify CLASSPATH to the corresponding directory when you run Java class.

such as Javac Self\equal.java, Java self.equal

6, JAR-CVF Abc.jar ABC package the contents of the ABC directory as Abc.jar

-XVF Abc.jar to extract the contents of Abc.jar

-TVF Abc.jar Viewing the contents of Abc.jar

-CVMF MYPAIRVALUE.MF Abc.jar ABC to package the contents of ABC while setting properties in Mypairvalue. You can specify Main-class as Abc.classname,jar package to run through Java-jar Abc.jar

7, one includes the checked exception (throw declaration) and the non-checked exception (RuntimeException and error subclass), can be seen by printstacktrace the stack trajectory of the exception

8, Java constructors cannot be used in abstract, synchronized, final retouching

9, the call System.GC () method shown can prompt the garbage collector to perform a sweep. Before an object is deleted by the garbage collector, its Finalize method is called

10, the interface replaces the multiple inheritance used in C + +

11, you can call another constructor at the entrance of the constructor with this, or you can call the constructor of the base class at the entrance of the constructor by super. Because the default constructor for the base class is implicitly called by default, Super's call is used only to call the base class constructor with parameters.

In Java, the interface function defaults to Public,abstract, implements the interface class must implement all functions, otherwise it must be an abstract

13, you can declare a class between any curly braces.

p190, an important use of an inner class is to build an adapter class. The purpose of an adapter class is to bind to a class without destroying its encapsulation. The local variables of any method referenced by the inner class of the method must be final, because in a call to a method, all the internal class instances that are created must see the same local variable.

p199, = = Check the identity, only point to the same object when conjecture, equals check equality, the value is equal, like

Java Learning Guide Learning notes

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.