Java-android study (Next day)

Source: Internet
Author: User

Continue to familiarize yourself with the Eclipse IDE today.

①, "Invalid project description." When import already has a project

One of the most likely causes of this error is:

This project is under the working directory of Eclipse. Therefore, copying the project to another directory and then trying to import it will, in most cases, solve the problem.

However, the imported project name has changed, and this time, it is possible to "rename" ...

②, Eclipse project name renaming

Right-click →refactor→rename, or use the shortcut key F2 (tick update reference).

/////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

③ and the understanding of @override

For C #, with the override keyword, the override keyword is placed in front of the method name (which is part of a method definition) to represent the method of overriding the base class;

For Java, using @override to "label" a method is also considered a component of the method definition, and the following is the understanding of @override in Java:

@Override is a pseudo-code that represents an overriding

1, can be used as a comment, easy to read, but case sensitive;
2, the compiler can give you to verify that @override the following method name is all in your parent class, if the parent class does not have the method, the error;

If you do not write @override, and your next method name is wrong, then your compiler can be compiled through, because the compiler thought this method is your subclass of your own added method.

In summary, the methods in the overriding base class (parent Class) in C # and Java are either overridden, or @override, but slightly different in form.

④, the meaning of the package at the beginning of the Java program and the Import ...

A package in Java is a class library unit that contains a set of classes that are organized together under a single namespace. This namespace is the package name.

You can import a package by using the Import keyword. For example, using Import java.util.*, you can import all the classes in the namespace Java.util package. The so-called import of all the classes in this package, that is, after the import declaration of the package name, in the next program can directly use the class in the package. a question, what is the difference between importing a package and importing a class?

Understand that the package→c# namespace in Java

Import→c#using in Java (you need to add a reference before you can using,c# some references have been added by default)

⑤, Eclipse's individual use tips

This afternoon when trying to create a package, class, and then import class (or packages), creating an object (instance) of the class, always feels that eclipse is not smart enough ...

In fact, is not not intelligent, is eclipse in the initial default situation, a lot of use hints are not set, or set the limitations are relatively large, we need to re-set according to their own circumstances.

For example: vs programming is very smart, the definition of a string every hit a keyword will have an intelligent matching prompt, and then the space, the full input into the, very fast; but by default, eclipse does not, you need to enter a complete keyword, you will be prompted to enter the correct or not, ,, this is too inconvenient

At this point, you need to do the following:Content Assist, Editor, Java---Perferences, Window--------windows, Eclipse, is found in the bottom right column auto-act Ivation, here are three options to find the second "Auto activation triggers for Java:" will be inside the "." Replace it with "abcdefghijklmnopqrstuvwxyz.", so that when we enter a letter or ".", it will be smart to prompt.

Java-android study (Next day)

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.