首页 > 其他分享 >Method Demo01

Method Demo01

时间:2023-10-22 13:01:33浏览次数:25  
标签:int System public Demo01 add static Method out

package com.chen.method;

public class Demo01 {
//main方法
public static void main(String[] args) {
int sum = add(1, 2,3);
System.out.println(sum);
// test();
}

//加法
public static int add(int a, int b) {
return a + b;

}

public static int add(int a, int b, int c) {
return a + b + c;
}

public static void test() {
for (int i = 0; i < 100; i++) {
if (i % 5 == 0) {
System.out.print(i + "\t");
}
if (i % (3 * 5) == 0) {
System.out.println();
//System.out.print("\n");
}
}
}
}

标签:int,System,public,Demo01,add,static,Method,out
From: https://www.cnblogs.com/jingyichenloveningning/p/17780305.html

相关文章

  • 【PowerShell】Invoke-WebRequest和Invoke-RestMethod
    ##PublicfreeRestfulAPIURL ##https://documenter.getpostman.com/view/8854915/Szf7znEe#intro#Example01#--------------------------------------------------------------$url="https://cat-fact.herokuapp.com/facts/"$r=Invoke-WebReques......
  • Struct SwitchDemo01
    packagecom.chen.struct;importjava.util.Scanner;publicclassSwitchDemo01{publicstaticvoidmain(String[]args){//case穿透//switch匹配一个具体的值chargrade='C';switch(grade){case'A':......
  • Struct SequenceDemo01
    packagecom.chen.struct;publicclassSequenceDemo01{publicstaticvoidmain(String[]args){System.out.println("hello1");System.out.println("hello2");System.out.println("hello3");System.o......
  • Struct DoWhileDemo01
    packagecom.chen.struct;publicclassDoWhileDemo01{publicstaticvoidmain(String[]args){inti=0;intsum=0;do{sum=sum+i;i++;}while(i<=100);System.out.println(sum);}}......
  • IDEA 出现 Cannot resolve method getParameter() in JSP 解决方法
    原链接java-CannotresolvemethodgetParameter()inJSP-StackOverflowIDEA中出现下图情况,版本IDEA2022.2.3。此方法大概率可用,如果帮到你请点个赞吧~  1.我们右键当前项目,选择进入"OpenModuleSettings",如下图2.进入下图界面后,点击下图加号弹出二级菜单,在通......
  • [914] In Python's datetime library, you can format dates using the strftime() me
    InPython'sdatetimelibrary,youcanformatdatesusingthestrftime()method.Thismethodallowsyoutocreateaformattedstringrepresentationofadatetimeobject,specifyingtheformatyouwant.Here'showyoucanformatadateusingstrft......
  • Program does not contain a static 'Main' method suitable for an entry point
    http://www.kangry.net/blog/?article_id=391&type=article修改办法,对着项目右键-》属性-》application-》outputtype设为ClassLibrary即可。  ......
  • [905] The replace() method in Pandas
    InPandas,thereplace()methodisusedtoreplacevaluesinaDataFrameorSeries.Youcanusethismethodtoreplaceoneormorespecifiedvalueswithothervalues.Here'showyoucanuseit:Syntax:DataFrame.replace(to_replace,value,inplace=Fal......
  • 核方法(kernel method)的主要思想
    本文对核方法(kernelmethod)进行简要的介绍(https://www.jianshu.com/p/8e2649a435c4)。核方法的主要思想是基于这样一个假设:“在低维空间中不能线性分割的点集,通过转化为高维空间中的点集时,很有可能变为线性可分的”,例如下图   左图的两类数据要想在一维空间上线性分开......
  • operator Demo01
    packageoperator;publicclassDemo01{publicstaticvoidmain(String[]args){//二元运算符inta=10;intb=20;intc=25;intd=25;System.out.println(a+b);System.out.println(a-b);System......