Kotlin Sorting out interview questions

1, What is? kotlin

kotlin By JetBrains Developed static type programming language , Run in JVM upper .

 

2, Why Kotlin language

Kotlin Concise and efficient language , There is not so much redundant code , And it's empty and safe .

 

3, Explain extension function

extension Function is used to class Expand , Not from class derive

 

4,kotlin Empty security in null safety What do you mean?

The feature of null security is to avoid null pointer exceptions , It can also be used to distinguish between null and non null references .

 

5,kotlin Why and java Interoperability

Because for jvm Generally speaking, they are the same after compilation , After compilation byte code stay jvm Run on

 

6,kotlin Is there a ternary operator in

non-existent

 

7,kotlin How to declare a variable in

var name: String

 

8,kotlin How many constructors are there

two types , One is primary Constructor , One is secondary Constructor

 

9, Say it kotlin Medium for Java.io.file Extension method of

bufferedReader,readBytes,readText,forEachLine,readLines

 

10,kotlin How to handle null exceptions

use elvis The operator handles null exceptions ?: , ?. 

 

11, What are the characteristics ,kotlin Yes and java No,

null safety,operator overloading,coroutines, range expressions, smart cast,
compaion object

 

12,kotlin The role of data classes in

Data classes contain basic data types , However, it does not contain any function functions

 

13, Can put java Code conversion to kotlin Code

Can be in AndroidStudio perhaps JetBrains Intermediate conversion

 

14,kotlin allow macros Do you

kotlin Macros are not supported

 

15,kotlin Default behavior of class

kotlin The default is final of . because kotlin Support multiple class inheritance , Open classes cost more than final Class is much higher

 

16,kotlin Is the original data type supported

kotlin Raw data type is not supported

 

17, What is? range Operator

range The operator is used to traverse a range , Represented by two points

for(i in 1..5)

    print(i)

 

18,kotlin Of standards java Do libraries and classes provide additional functionality

kotlin The program is standard java On virtual machines , therefore kotlin and java There is no difference at this level ,java You can also directly kotlin Run in program

 

19, stay kotlin Define a volatile variable

volatile var x: Long? = null

 

20,kotlin What is the role of abstraction in

Abstract is the most important concept of object-oriented programming . Characteristics of abstract classes : Do you know what this class will do , But I don't know how to realize these functions and what functions to realize .

 

21,kotlin How to compare two strings

(1)==

(2).equals(Any?)

 

22, What is this code for

bar {

System.out.println("1111")

}

bar As a function , Receiving an expression as an argument , This expression prints a line of string

 

23,kotlin Higher order function

 

Technology
©2019-2020 Toolsou All rights reserved,
What is a process , Concept of process ? Tang Seng team to lay off staff , Who will you lay off ?Oracle Database access performance optimization JVM Old age garbage collection Full GCweb Two front-end practical games ( Attached source code ) about linux command “iptables -F”, Don't carry it out easily navicat function sql File error 2021-06-03 A man is not born to be defeated Pandas And openpyxl Super combination of Library , bye ,Excel! It is never recommended to spend a lot of time studying for employment python