关于我学了因为java又回来这档事

持续更新中.......


 

1.Hi, again.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package helloworldagain;

/**
 *
 * @author gengyf
 */
public class HelloWorldAgain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.print("Hello World Again!");
    }
    
}

 

2.something like a+b

import java.util.*;//java中输入所需调用的东西
public class Main {
    public static void main(String[] args) {
     int a,b; Scanner in
=new Scanner(System.in);//输入前的准备 a=in.nextInt();b=in.nextInt();//输入 System.out.println(a+b);//输出 } }

注意:将代码提交到OJ上时,需要将程序前的package删掉,并将主函数名改为Main

 

3.something about math

4.an other function

5.字符串转字符数组

 

String ss=in.nextLine();//读入一整行
char[] a=ss.toCharArray();//把这一行的每个字符转存在数组里

 

posted @ 2021-10-14 08:59  喵の耳  阅读(45)  评论(0编辑  收藏  举报