我是靠谱客的博主 虚心毛豆,这篇文章主要介绍Android studio 运行main 函数的方法,现在分享给大家,希望可以做个参考。

标题Gradle构建问题

切换到Project工程下.idea/gradle.xml添加属性
<option name="delegatedBuild" value="false" />

图例

PS:下面通过示例代码看下JAVA中的main函数

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.han; public class HanTest { public static void main(String[] args){ if(args==null){ throw new NullPointerException("The input is "null""); }else if((args.length!=1&&args.length!=2)){ Throwable cause=new Throwable("You have to input 1 or 2 String arguments"); throw new IllegalArgumentException("Wrong numbers of args",cause); //throw new IllegalArgumentException("Wrong numbers of args"); }else if(args.length==1){ System.out.println(args[0]); }else if(args.length==2){ System.out.println(args[0]); System.out.println(args[1]); } } } package com.han; public class HanTest2 { public static void main(String[] args){ String[] input={"han"}; //HanTest.main(null); HanTest.main(input); } }

总结

到此这篇关于Android studio 运行main 函数的方法的文章就介绍到这了,更多相关Android studio 运行main 函数内容请搜索靠谱客以前的文章或继续浏览下面的相关文章希望大家以后多多支持靠谱客!

最后

以上就是虚心毛豆最近收集整理的关于Android studio 运行main 函数的方法的全部内容,更多相关Android内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(156)

评论列表共有 0 条评论

立即
投稿
返回
顶部