First, Java foundation
1. The Meaning of Interface (Baidu)
Specification, extension, callback
2. The meaning of Abstract Classes (LetV)
Provide a common type for its subclasses
Encapsulate duplicate content in subclasses
Define abstract methods. Subclasses have different implementations but the definitions are consistent
3. The role of internal Classes (Baidu, LeEco)
An inner class can have multiple instances, each of which has its own state information and is independent of the information of other peripheral objects.
Within a single enclosing class, you can have multiple inner classes implement the same interface in different ways, or inherit from the same class.
The time at which the inner class object is created does not depend on the creation of the outer class object.
The inner class does not have a confusing “IS-A” relationship; it is a separate entity.
The inner class provides better encapsulation and is not accessible by any other class except the enclosing class
4. Can a static method of a parent class be overridden by a subclass? Why? (leopard)
Can’t
Subclass inherits the parent class, use the same method of static and non-static methods, then non-static methods covered in the parent class method (namely rewriting), the static method of the parent is hidden (if the object is the parent class is called the hidden method), the other a subclass inherits the parent class of the static and non-static methods, as for the method overloading I think it is one of the elements in the same class, Can’t say what method in a parent class or what method in a child class is a reflection of method overloading
5. Cite 1-2 sorting algorithms, and use Java code implementation (Meituan)
http://blog.csdn.net/qy1387/article/details/7752973
6. Java VIRTUAL Machine features (Baidu, LetV)
A very important feature of the Java language is its platform-independence. The use of Java virtual machine is the key to achieve this feature. Normal high-level languages need to be compiled into at least different object code if they are to run on different platforms. With the introduction of the Java language VIRTUAL machine, the Java language does not need to be recompiled when running on different platforms. The Java Language Usage Pattern The Java Virtual machine shields platform-specific information, allowing Java language compilers to run on multiple platforms without modification, simply by generating object code (bytecode) that runs on the Java Virtual machine. When the Java virtual machine executes bytecodes, it interprets the bytecodes as machine instructions on a specific platform.
Ii. Android basics
1. What are the operation types of databases and how do I import external databases?
Include the original database in the project source code in RES/RAW
Android database should be stored in /data/data/com.. (Package name)/directory, so all we need to do is pass the existing database into that directory. To do this, use FileInputStream to read from the original database, and use FileOutputStream to write the read to that directory.
2. Have you used local broadcast? What is the difference between global broadcast and local broadcast?
Because broadcast data is spread within the scope of this application, there is no need to worry about privacy data leakage.
There is no need to worry about other applications forgery broadcast, causing security risks.
It is more efficient than sending a global broadcast within the system.
3. Have you ever used intentServer, what is its function and what problems has AIDL solved? (millet)
Generate a default worker thread independent of the main thread to execute all Intetnt passed to the onStartCommand() method.
Create a work queue to deliver Intent objects to your onHandleIntent() method, one at a time, so you don’t have to worry about multithreading. The service is stopped automatically after all intents have been executed, so you don’t need to call the stopSelf() method to stop.
The service provides a default implementation of the onBind() method, which returns NULL.
Provides a default implementation of the onStartCommand() method, which delivers an Intent to a work queue and then fetches it one at a time from the work queue to the onHandleIntent() method, where the Intent is handled accordingly.
AIDL (Android Interface Definition Language) is an IDL Language. Code that generates interprocess communication (IPC) between two processes on an Android device. AIDL can be used to generate serializable parameters if you want to invoke an operation on an object in one process (such as an Activity) in another process (such as a Service).
The AIDL IPC mechanism is interface oriented, like COM or Corba, but more lightweight. It uses proxy classes to pass data between the client and the implementation.
4. What is the difference between Activity, Window and View? (360).
An Activity is like a craftsman (control unit), a Window is like a Window (host model), and a View is like a Window (display View).
Layoutinflaters are like scissors, and Xml configurations are like paper-cuts.
Calling Attach in the Activity creates a Window
Create window is a subclass of PhoneWindow, create PhoneWindow in Attach
Call setContentView(r.layout.xxx) in your Activity.
Which is actually calling getWindow().setContentView()
Call the setContentView method in PhoneWindow
Create ParentView: as a subclass of ViewGroup, actually create DecorView(as a subclass of FramLayout)
Fill the specified r.layout. XXX fill it with the layout filler
Calls to a ViewGroup
Call removeAllView() on the ViewGroup to remove all views
Add a new view: addView()
Characteristics of fragments
Fragments can appear as part of the Activity interface;
You can have multiple fragments in an Activity at the same time, and a Fragment can be used in multiple activities.
You can add, remove, or replace fragments while an Activity is running.
Fragments can respond to their own input events and have their own life cycles, which are influenced by the life cycle of the host Activity.
Reproduced in making: https://github.com/JackyAndroid
Friend me and add you to the group: