什么是方法

package com.gao.方法;

public class d1 {
    //main方法
    public static void main(String[] args) {

     //   int sum= add(1, 2);
        // System.out.println(sum);
        test();

    }
    //加法
    public  static int add(int a,int b){
        return a+b;
    }
    public static void test(){
        int a=0;
        for (int i = 0; i <=1000; i++) {
            if(i%5==0){
                a++;
                System.out.print("\t"+i);
                if(a>=3) {
                    System.out.println();
                    //System.out.print("\n");
                    a = 0;
                }
                }
            }
    }

}


	0	5	10
	15	20	25
	30	35	40
	45	50	55
	60	65	70
	75	80	85
	90	95	100
	105	110	115
	120	125	130
	135	140	145
	150	155	160
	165	170	175
	180	185	190
	195	200	205
	210	215	220
	225	230	235
	240	245	250
	255	260	265
	270	275	280
	285	290	295
	300	305	310
	315	320	325
	330	335	340
	345	350	355
	360	365	370
	375	380	385
	390	395	400
	405	410	415
	420	425	430
	435	440	445
	450	455	460
	465	470	475
	480	485	490
	495	500	505
	510	515	520
	525	530	535
	540	545	550
	555	560	565
	570	575	580
	585	590	595
	600	605	610
	615	620	625
	630	635	640
	645	650	655
	660	665	670
	675	680	685
	690	695	700
	705	710	715
	720	725	730
	735	740	745
	750	755	760
	765	770	775
	780	785	790
	795	800	805
	810	815	820
	825	830	835
	840	845	850
	855	860	865
	870	875	880
	885	890	895
	900	905	910
	915	920	925
	930	935	940
	945	950	955
	960	965	970
	975	980	985
	990	995	1000

进程已结束,退出代码为 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值