Run single java file with standard main(String [] args) method - Android Studio

后端 未结 5 1015
青春惊慌失措
青春惊慌失措 2020-12-17 16:16

To start with - Yes, I know that this is crazy/strange. But I need it :).

I want to find simpliest way to run single java file (and prefer non-termi

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 16:57

    One thing that might be confusing you, like it was confusing me:

    If there is the standard method to start Java application

    public static void main (String[] args ) {
    // your block here
    
    }
    

    Android Studio will automatically give an option "Run YourClass.mainActivity()", when you right-click anywhere in the editor's editing space.

    Just right click in the Java file and there will be an option to run that particular Java class.

提交回复
热议问题