Simple Primer for Android development and Java language Basics [map]

Source: Internet
Author: User

Simple Primer for Android development and Java language Basics [map]
Objective:
By the end of last year, I had done a simple smart home, and also realized some simple direct connect and remote smart home. So the simplest communication is released: Smart home Simple Implementation-use ESP8266 simple implementation and app communication
Because of the small amount of information in this area, the reading volume soared rapidly. There are also a lot of people who add friends to ask me questions. Through the problem I found that many are learning hardware, or do smart home aspects of students, the basic will not be Android development. Ask a lot of questions about how I learned to develop Android.
Many people know or stay in learning this software development technology needs to go to the training institutions to report a class, or go to school to study related majors. In fact, the introduction of basic software development, there is no need for the above operation. Now the information on the Internet so rich, their own thoughts can find a lot of good information, and then the system of learning, completely can achieve the requirements, there is no need to spend those time and money.
In view of the above requirements, I am here to summarize how simple to get started with Android. Now Android development is supported in two languages, Java and Kotlin. Kotlin was only last year Google officially announced support for Android development, so the use is not too broad, the main body is still more Java. So choose to learn the basics of the Java language and then learn the basics of Android development.
Java Language Basics:

Learning Java Foundation, I have been experienced, beginners are recommended video plus books. Although here to combine books, in fact, I have not bought the Java foundation of the book, I use the site instead of, there is a Web site in written form to the Java Foundation Show pretty good.
Java Enterprise face question featured OOP:
2.11. Can I inherit the String class?
Reference Answer:
?? The string class is the final class, so you cannot inherit
2.12. Explain the role of the static keyword
Reference Answer:
?? Static means to modify the member variables and member methods, or to form static blocks of code. As long as this class is loaded, the Java virtual machine can find them based on the class name in the method area of the run-time data area. Therefore, the STAITC member can be accessed before any of its objects are created. You do not need to reference any objects.
?? 1) Modify member variables. member variables modified with static do not belong to the data structure of the object; Static variables are variables that belong to classes, and static members can often be referenced by class names; static member variables and class information are stored in the method area, not in the heap. A static member variable of a class has only "one copy", regardless of how many objects the class creates.
?? 2) modifies the member method. The static adornment method does not need to operate on certain objects, and its result is only related to the input parameters, and is referenced directly by the class name when called. Because static does not have a specific object at the time of invocation, the static method cannot be used on a non-static member (object member ) is accessed. The static method is intended to provide some "tool methods" and "Factory methods".
?? 3) Static BLOCK: A block of code that is part of a class that executes during class loading and executes only once and can be used to load static resources in the software.
2.13. Explain the meaning and usage of the Java keyword
1) Abstract
2) extends
3) final/finally
4) implements
5) Import
6) instanceof
7) Synchronized
8) Throw/throws
Reference Answer:
1) Abstract: Abstractions, modifiers, classes and methods. The class containing the abstract method is an abstraction class, and the abstract method is primarily intended to allow subclasses to inherit the implementation.
2) Extends: inheritance, subclasses add a variable or method by inheriting the parent class, or override a method of the parent class, and the child interface inherits the parent's pretext to add the method.
3) final/finally:final is used to define constants. Finally is used to execute a piece of code, regardless of whether there are exceptions or run-time errors in the Try statement defined earlier.
4) Implements: It is optional in the declaration of the class to indicate the interface that the current class implements.
5) Import: At the beginning of the source file, indicate a class or an entire package that will be introduced later.
6) Instanceof: Determine the actual type of object it points to.
7) Synchronized: Modifier method or method block. Prevents multiple threads from accessing the synchronized block in this class at the same time.
8) Throw/throws:throw allows the user to throw a exception object or any object that implements Throwable. Throws is used in the declaration of the method to illustrate which exceptions this method is not processed, but is submitted to a higher level of the program.
2.14. What is the difference between a static variable and an instance variable?
Reference Answer:
?? Static variables, also known as class variables, are common to all classes, are not dependent on an object, can be accessed directly through the class name, and the instance variable must be dependent on an instance that can only be accessed through an object.
What is 2.15.GC? Why do you have a GC?
Reference Answer:
?? GC is the meaning of garbage collection (Gabage Collection), memory processing is where programmers are prone to problems, forgetting or wrong memory recycling can cause program or system instability or even crashes, The GC functionality provided by Java can automatically detect whether an object exceeds the scope to achieve the purpose of auto-reclaiming the memory. Java programmers can automatically determine and recycle garbage when they are programming without having to worry about releasing the memory when the variable is not used.
2.16. The merits and principles of the number of pieces of garbage collection. and Example 2 recycling mechanism
Reference Answer:
One notable feature of the Java language is the introduction of a garbage collection mechanism, which makes it possible for C + + programmers to solve the most troublesome memory management problems, which makes it unnecessary for Java programmers to consider memory management when writing programs. Because there is a garbage collection mechanism, objects in Java no longer have the concept of "scope", Only references to objects have scope.Historical RecordsExperience, garbage collection can effectively prevent memory leaks, effective use of memory can be used.
?? The garbage collector is usually run as a separate low-level thread, and in unpredictable cases the dead or unused objects in the heap are purged and reclaimed, and the programmer cannot call the garbage collector in real time to garbage collection of an object or all objects.
1) Incremental Collector
?? The incremental collector divides the stack into multiple domains, collecting garbage from only one domain at a time. This results in a smaller application outage.
2) Generational collector
?? This collector divides the stack into two or more domains for storing objects of different lifetimes. A new object generated by the JVM is typically placed in one of the domains. Over time, objects that continue to exist will receive a lifetime and go into a longer-lived domain. The generational collector uses different algorithms for different domains to optimize performance.

Simple Primer for Android development and Java language Basics [map]

Related Article

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.