Scanner

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

Random

import java.util.Random;

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

ArrayList

import java.util.ArrayList

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

String

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

Arrays

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

import java.util.Arrays;

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

Math

import java.lang.Math

public static double Math.abs(double a):

// :返回大于等于参数的最小整数
public static double ceil(double a) // 返回小于等于参数的最大整数
public static double floor(double a) // 返回最接近参数的long
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. Fiddler中显示IP方法

    如何在fiddler查看到请求的IP地址?就像下面这样 打开fiddler, 快捷键Ctrl+R  或者  菜单->Rules->Customize Rules…,然后在CustomRul ...

  2. 「AtCoder Grand018B」Sports Festival(暴力)

    题目链接B - Sports Festival 题意 n(1~300)个人m(1~300)个活动,\(A_{ij}\)表示i第j喜欢的活动,每个人选择在举办的活动里最喜欢的,因此可以通过选择一些活动来 ...

  3. Centos 7.3 安装Grafana 6.0

    grafana简介 Grafana是一个完全开源的度量分析与可视化平台,可对来自各种各种数据源的数据进行查询.分析.可视化处理以及配置告警. Grafana支持的数据源: 官方:Graphite,In ...

  4. 【dfs】p1451 求细胞数量

    题目描述 一矩形阵列由数字0到9组成,数字1到9代表细胞,细胞的定义为沿细胞数字上下左右若还是细胞数字则为同一细胞,求给定矩形阵列的细胞个数.(1<=m,n<=100)? 输入输出格式## ...

  5. centos7/rhel7下配置PXE+Kickstart自动安装linux系统

    应用场景:临时安装一个系统或者批量安装linux系统,无需人工介入选择下一步,减少在安装系统上的时间浪费,提高工作效率. DHCP + TFTP + Syslinux + FTP + Kickstar ...

  6. centos7系统排错

    系统排错 troubleshooting winPE --光盘或u盘启动盘 产生一个PE系统(类似内存上跑的临时系统) 系统排错 rescue 模式 (挽救模式) 类似windows winPE模式 ...

  7. Python3 与 C# 并发编程之~ 线程篇

      2.线程篇¶ 在线预览:https://github.lesschina.com/python/base/concurrency/3.并发编程-线程篇.html 示例代码:https://gith ...

  8. 初入react-redux (基于webpack babel的react应用框架)

    react这么热门的框架也不介绍了,redux是一个单项数据流的小框架,当然不只配合react,它起初是为react而配的,现在面向所有了,比如ng-redux的项目.redux做为react的标准搭 ...

  9. SSH出现Connection refused错误

    笔者在使用ssh localhost时出现Connection refused提示,初步判断是22端口未开启服务,也有可能是防火墙未正确配置. 测试 使用netstat | grep 22测试,发现2 ...

  10. JS判断手机还是电脑访问网站

    function check() { let browser = navigator.userAgent;//用户访问的类型 let phone = ["Android", &qu ...