你能否在技术上调用主要方法中的任何字符串[]? [英] Could you technically call the string[] anything in the main method?

查看:155
本文介绍了你能否在技术上调用主要方法中的任何字符串[]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

main 方法的头部是

  public static void main(String [] args)

你能用技术来取代你想要的任何东西吗?另外,为什么参数是一个数组?

解决方案

args 方法中参数的名称。你可以将它重命名为任何你想要的。 JVM不需要知道 的参数是什么;只有 type String [] 很重要。 点的应用程序

pre $ code static static main(String [] whateverYouNeed)


The header for the main method is

public static void main (String[] args)

Could you technically replace "args" with anything you want? Also, why is the parameter an array?

解决方案

args is just a name for the argument in a method. You can rename it to whatever you want. The JVM doesn't need to know what the argument is named; only the type, String[], is important.

dont break the start point of the app

 static void main(String[] whateverYouNeed)

这篇关于你能否在技术上调用主要方法中的任何字符串[]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆