Home > Mobile >  Better than Java trival beginners kotlin, how to feel
Better than Java trival beginners kotlin, how to feel

Time:09-18

A. The colon:
Saw that it was really weird and my input method to shift switch into Chinese by default, often accidentally hit the Angle of the colon;
 
Var STR: String=""
Fun inc (I: Int) : Int {
Return the I + 1
}

Look again at the same code of Java, who is more concise?
 
String str="";
Int inc (int I) {
Return the I + 1;
}




2. The return value is written in the most behind
Kotlin often read like this code
 
Fun kafkaTemplate (
@ Value (" \ ${interactions. Kafka. The bootstrap - the servers - dc1} ") bootstrapServersDc1: String,
@ Value (" \ ${interactions. Kafka. The bootstrap - the servers - dc2} ") bootstrapServersDc2: String,
CloudMetadata: cloudMetadata,
@ Value (" \ ${interactions. Kafka. Batch - size} ") batchSize: Int,
@ Value (" \ ${interactions. Kafka. Linger - ms} ") lingerMs: Int,
MetricRegistry: metricRegistry
) : KafkaTemplate {
Val bootstrapServer=the if (cloudMetadata datacenter=="dc1") {
BootstrapServersDc1
}
}

Oh, my gosh! I YanZhuo, is to see for a long time to find the return value of slit type!!!!!!!!!!


3. Multiple array (which is by far the most bad, don't know if kt have other concise writing)
First take a look at the Java defines multiple array
 
String [] [] [] STRS=new String [2] [3] [4].

Look again at kt define multiple array? God, this is called simple???????
 
Val a=Array (5) {Array (5) {arrayOfNulls (5)}}

CodePudding user response:

Can need not kotlin don't use it! Language is really an egg pain, now my feeling is the language and its tedious, if really can reduce the amount of code, is also a need to spend some time to study, maintenance, Java engineer plum now the whole country, it is easy to recruit a qualified Java engineer, but kt engineers are in trouble

CodePudding user response:

You put the Android application using Kotlin substitute gradually, and then found that the boss can not find people transition

CodePudding user response:

Have to give you a raise

CodePudding user response:

reference Han Shuliang reply: 3/f
have to give you a raise
so as to pay attention to the boss, if you want to use kotlin of engineers, to stop him from

CodePudding user response:

reference 4 floor fring2012 response:
Quote: reference Han Shuliang reply: 3/f

Have to give you a raise
so as to pay attention to the boss, if you want to use kotlin of engineers, to stop him from


No boss in this BBS, farmers are code

CodePudding user response:

Or c language syntax look good
  • Related