简体   繁体   中英

how to write runnable method like "fun main()" in kotlin with java in android studio

in the Kotlin if you out of the class write this code

fun main(){
System.out.println("ali")
}

you can run this method without run emulator. android studio show play icon first the method if you write this code in Kotlin and you can run only this method. I want do it in Androidstudio Java. are you know how do it? thank you

Main in java is:

public class Main {
    public static void main(String args[]) {
        //you code here
    }
}

If this solution doesen't work you can use Junit test case in order to run one specific method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM