zoukankan      html  css  js  c++  java
  • kotlin笔记

    类的继承以及接口实现都需要使用:

    例如

    class WIGLSurfaceView : GLSurfaceView 

    class WLRender : GLSurfaceView.Renderer 

    构造方法需要使用contructor关键字
    class WLRender : GLSurfaceView.Renderer {
    constructor(context: Context) {
    this.context = context
    vertexBuffer = ByteBuffer.allocateDirect(vertexData.size * 4).order(ByteOrder.nativeOrder()).asFloatBuffer()
    .put(vertexData);
    vertexBuffer.position(0)
    }
    }


    不需要使用switch,使用when以及lamda表达式

    while循环替换使用方法
    java
    while((line = reader.readLine()) != null)
    {
    sb.append(line).append(" ");
    }
    kotlin
    do {
    line = reader.readLine()
    if (line == null) {
    break
    }
    sb.append(line).append(" ")
    } while (true)

    int以及float数组不使用[],而是使用相关的类
    var lineStatus = IntArray(1)
    val vertexData: FloatArray = floatArrayOf(-1f, 0f, 0f, 1f, 1f, 0f)




  • 相关阅读:
    查看网桥
    openstack 网卡
    fuel3.2安装
    whereis命令查看你要添加的软件在哪里
    ubuntu12.04开启远程桌面
    ubuntu 右键添加terminal
    本地源设置方法:
    ubuntu的dns设置
    chubu
    Linux内存
  • 原文地址:https://www.cnblogs.com/dongweiq/p/10974286.html
Copyright © 2011-2022 走看看