zoukankan      html  css  js  c++  java
  • main()的简单理解

     1 /*
     2  * main()方法的使用说明
     3  * 1.main()作为程序的入口
     4  * 2.main()也是普通的静态方法,可以通过类调用
     5  * 3.main()的形参也可以作为我们与控制台交互的方式(之前,使用Scanner)
     6  */
     7 public class test {
     8 public static void main(String[] args)//入口,权限要大
     9 {
    10     Main.main(args);
    11     show();
    12     test a=new test();
    13     a.play();
    14     
    15     int num=Integer.parseInt(args[0]);
    16     System.out.println(num);
    17     /*
    18      * 左键run as->run configurations->
    19      * arguments->program arguments->输入值->
    20      * run->输出答案
    21      */
    22 }
    23 public static void show()
    24 {
    25     //静态里才能调用静态
    26 }
    27 public void play()
    28 {
    29     //可以通过对象调用非静态
    30 }
    31 }
    32 class Main
    33 {
    34     public static void main(String[] args)
    35     {
    36         args=new String[10];
    37         for(int i=0;i<args.length;i++)
    38         {
    39             args[i]=""+i;
    40             //System.out.println(args[i]);
    41         }
    42     }
    43 }
  • 相关阅读:
    AnyVal与AnyRef
    安装Zookeeper
    Kafka
    ZooKeeper总结
    Idea中JDK为1.8,还提示Diamond types are not supported at this language level
    Hive 和 Mysql
    Spark练习代码
    响应状态码
    http简介
    csrf
  • 原文地址:https://www.cnblogs.com/zuiaimiusi/p/10828738.html
Copyright © 2011-2022 走看看