美文网首页
Android studio 4.0新建类不带public

Android studio 4.0新建类不带public

作者: 雨来 | 来源:发表于2020-07-03 18:04 被阅读0次
    默认的是这个样子的
    image.png
    #if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
    
    #if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
    #end
    #parse("File Header.java")
    #if (${VISIBILITY} == "PUBLIC")public #end #if (${ABSTRACT} == "TRUE")abstract #end #if (${FINAL} == "TRUE")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
    }
    
    
    修改成下面这样再新建类的时候就默认带public了
    #if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
     
    #if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
    #end
    #parse("File Header.java")
    #if (${VISIBILITY} == "public") public #end #if (${VISIBILITY} == "") public #end #if (${ABSTRACT} == "true")abstract #end #if (${FINAL} == "true")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "") implements ${INTERFACES} #end {
    } 
    

    其实语法是这样的

    #if (${VISIBILITY} == "public") public #end #if (${VISIBILITY} == "") public #end 
    

    解释 #if (${VISIBILITY} == "") public #end 如果为"" 则为public 主要是这一句的作用 如果VISIBILITY =""的话则默认为public

    相关文章

      网友评论

          本文标题:Android studio 4.0新建类不带public

          本文链接:https://www.haomeiwen.com/subject/beqeqktx.html