Scanner

  1. import java.util.Scanner;
  2. /*
  3. public int nextInt(): to get a integer from keyboard
  4. public String next(): to get a string from keyboard,end with space;
  5. Scanner sc = new Scanner(System.in);
  6. */

Random

  1. import java.util.Random;
  2. // 构造方法:
  3. // public Random():创建一个新的随机数生成器;
  4. // 成员方法:
  5. // public int nextInt(int bound):产生0~n的随机数,但是不包括n

ArrayList

  1. import java.util.ArrayList
  2. // 构造方法:
  3. // public ArrayList():构造一个内容为空的集合
  4. // 基本格式:
  5. // ArrayList<String> StringList = new ArrayList<>();
  6. // ArrayList<Integer> intList = new ArrayList<>();
  7. // 成员方法:
  8. // public boolean add(E e):在集合中加入元素到尾部
  9. // public E remove(int index):删除指定位置上的元素,并且返回被删除元素;
  10. // public E get(int index):获取指定位置上的元素,并且返回;
  11. // public int size():返回几个元素的个数。

String

  1. import java.lang.String;
  2. // 位于java.lang,不用添加import语句;
  3. // 构造方法:
  4. // public String():构造一个空的字符串;
  5. // public String(char[] chars):以字符数组作为参数,据此构造一个字符串
  6. // public String(byte[] bytes):以字节数组作为参数,据此构造一个字符串
  7. // 成员方法:
  8. // 1.public boolean equals(Object ojb):字符串比较
  9. // 2.public boolean equalsIgoreCase(String anotherString):忽略大小写的比较
  10. // 3.public int length():return the length of the String
  11. // 4.public String concat(String str):将参数字符串连接到该字符串的末尾
  12. // 5.public char charAt(int index):返回指定索引处的char值
  13. // 6.public int indexOf(Strig str):返回参数字符串第一次出现在该字符串的位置,没有出现就返回-1
  14. // 7.public String substring(int beginIndex):从beginIndex开始截取字符串直到结尾
  15. // 8.public String substring(int beginIndex, int endIndex):从beginIndex开始截取字符串直到endIndex,不包括endIndex
  16. // 9.public char[] toCharArray():字符串转化为字符数组
  17. // 10.public byte[] getBytes():字符串转化为字节数组
  18. // 11.public String replace(CharSequence target, CharSequence replacement):将字符串中的target子串全都替换为replacement
  19. // 12.public String[] split(String regex):将字符串按照给定的规则拆分,返回一个字符串数组

Arrays

提供操作数组的方法,都是静态方法

  1. import java.util.Arrays;
  2. 1.public static String toString(int[] a):返回一直字符串
  3. int[] a = {1, 2, 3, 4, 5, 6};
  4. String str = Arrays.toString(a);
  5. System.out.println(str);// [1, 2, 3, 4, 5, 6]
  6. 2.public static void sort(int[] a):排序
  7. Arrays.sort(a);

Math

import java.lang.Math

  1. public static double Math.abs(double a):
  2. // :返回大于等于参数的最小整数
  3. public static double ceil(double a)
  4. // 返回小于等于参数的最大整数
  5. public static double floor(double a)
  6. // 返回最接近参数的long
  7. public static long round(double)

API(Scanner、Random、ArrayList、String、Arrays、Math)的更多相关文章

  1. API之Scanner,Random,ArrayList基础运用。重点是ArrayList

    有关API的这些类可以参考JDK的官方中文文档,看我的另一篇文章有下载==> https://www.cnblogs.com/gz18221/p/11968505.html<==文章地址 ...

  2. JAVA基础学习之 Map集合、集合框架工具类Collections,Arrays、可变参数、List和Set集合框架什么时候使用等(4)

    package com.itcast.test20140113; import java.util.ArrayList; import java.util.Arrays; import java.ut ...

  3. Python——常用模块(time/datetime, random, os, shutil, json/pickcle, collections, hashlib/hmac, contextlib)

    1.time/datetime 这两个模块是与时间相关的模块,Python中通常用三种方式表示时间: #时间戳(timestamp):表示的是从1970年1月1日00:00:00开始按秒计算的偏移量. ...

  4. 01 语言基础+高级:1-3 常用API第一部分_day07【Scanner类、Random类、ArrayList类】

    day07[Scanner类.Random类.ArrayList类] Scanner类Random类ArrayList类 教学目标 能够明确API的使用步骤能够使用Scanner类获得键盘录入数据能够 ...

  5. TensorFlow Object Detection API(Windows下测试)

    "Speed/accuracy trade-offs for modern convolutional object detectors." Huang J, Rathod V, ...

  6. Java(114-132)【Scanner类、Random类、ArrayList类】

    1.API概述和使用步骤 应用程序编程接口.Java的API是一本程序员的字典,学会查询 2.Scanner 概述及其API文档 键盘输入 类都是大写的Scanner,关键字是小写的public 3. ...

  7. java自学第4期——:Scanner类、匿名对象介绍、Random类、ArrayList集合、标准类格式、String类、static静态、Arrays工具类、Math类(1)

    一.Scanner类 1.api简介: 应用程序编程接口 2.Scanner类: 作用:获取键盘输入的数据 位置: java.util.Scanner. 使用:使用成员方法nextInt() 和 ne ...

  8. Scanner类、匿名对象、Random类、ArrayList集合、String类、static静态类、math类和Arrays工具类

    一.Scanner类 1.除了八种基本数据类型,其他都是引用类型: 引用类型使用三步骤: 2.Scanner类 引用jdk提供的类,Scanner在java.util包下,不在java.lang包(S ...

  9. Java运算符和引用数据类型(Scanner、Random)

    运算符 算术运算符: 运算符 运算规则 范例 结果 + 正号 +3 3 + 加 2+3 5 + 连接字符串 “中”+“国” “中国” - 负号 int a=3;-a -3 - 减 3-1 2 * 乘 ...

随机推荐

  1. 【POJ1037】A decorative fence(DP)

    BUPT2017 wintertraining(15) #6C 题意 给长度n的数列,1,2,..,n,按依次递增递减排序,求字典序第k小的排列. 题解 dp. up[i][j]表示长度为j,以第i小 ...

  2. android sqlite boolean 类型

    sql语句中 boolean (bit)类型的字段 ,insert 数据的时候 , 有null ,0 (false),1(true) 三个数可以选择. 例如: insert into pos valu ...

  3. SCOI2008着色方案(记忆化搜索)

    有n个木块排成一行,从左到右依次编号为1~n.你有k种颜色的油漆,其中第i 种颜色的油漆足够涂ci 个木块.所有油漆刚好足够涂满所有木块,即 c1+c2+...+ck=n.相邻两个木块涂相同色显得很难 ...

  4. 【linux】vim常用操作及vim插件的安装使用

    vim是linux下一个非常好用的文本编辑器,在linux下开发的人员要熟练掌握vim常用命令. 1.  打开在第n行 vim +143 filename.txt 2. 只读模式打开 vim -R / ...

  5. CentOS装个NTP时间同步服务器

    服务端: driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 ...

  6. JS监听滚动条进度

    HTML部分: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <s ...

  7. Methods for follow-up research of exome analysis:外显子后续分析研究思路总结

    外显子后续分析研究思路一般有以下几种(Methods for follow-up research of exome analysis): 1.对突变频率.突变类型.突变方式进行统计分析 Mutati ...

  8. Map.putAll方法——追加另一个Map对象到当前Map集合

    转: Map.putAll方法——追加另一个Map对象到当前Map集合(转) 该方法用来追加另一个Map对象到当前Map集合对象,它会把另一个Map集合对象中的所有内容添加到当前Map集合对象. 语法 ...

  9. C++ template一些体悟(2)

    class template的一般化设计之外,特别针对某些参数做特殊设计 #include <iostream> using namespace std; //一般设计 template& ...

  10. Luogu P1117 [NOI2016]优秀的拆分

    题目链接 \(Click\) \(Here\) 这题质量不错,就是暴力分有点足\(hhhhhhhh\),整整有\(95\)分. (搞得我写完暴力都不想写正解直接理解思路之后就直接水过去了\(QwQ\) ...