zoukankan      html  css  js  c++  java
  • 15_面向对象_02

    JavaAPI

    API (application  programming interface):应用程序编程接口

    JavaAPI 其实就是一本程序员的字典,是JDK中提供给程序员使用的类的说明文档
    这些类将底层的代码实现封装了起来,对于程序开发者来说,不需要关注底层如何实现,只需要
    掌握这些类在开发中是如何使用的。所以对于开发者来说可以通过查询API的方式,
    来学习Java提供的类,并得知如何使用他们。

    API使用步骤:
      1.打开帮助文档
      2.点击显示,找到索引,看到输入框
      3.在输入框中输入需要查找的类,然后回车
      4.看包,Java.lang下面的类不需要导包,其他需要
      5.看类的解释说明,类的结构
      6.学习构造方法
      7.使用成员方法,ctrl + F搜索需要的成员方法。

    Scanner类 扫描类 点击红线自动导包
      nextInt()
      nextDouble()
      nextLine()
      next()
    Random类 随机类
    随机数值
      nextInt()
      nextInt(int bound)
      nextDouble()
    ArrayList类
    长度可变数组 容器:插入数据,删除数据,查找数据,修改数据 crud操作
      add()
      add(int index,E element) //index索引
      remove(int index)
      remove(Object o)
      get(int index)
      ser(int index,E element)

    如何使用ArrayList:

    package com.zhiyou100.homework;
    
    import java.util.ArrayList;
    
    public class ArrayListDemo {
    
        public static void main(String[] args) {
            ArrayList<Integer> list = new ArrayList<>();//制定该容器中存储的数据类型为整数
            list.add(123);
            list.add(124);
            list.add(10);
            list.add(50);
            System.out.println(list.toString());
            //删除
            list.remove(0);//123删除
            list.remove(2);//直接删除10  删除第一个出现的
            System.out.println(list.toString());
            //查找查询
            Integer integer =list.get(1);//查询第二个数
            System.out.println(integer);
            //修改
            list.set(1, 100);
            System.out.println(list.toString());
            
        }
    
    }
  • 相关阅读:
    oracle(Xe)数据库远程连接需修改配置参数
    oracl 权限循环查询
    控件网站
    java常用类(1)
    关于webdriver和谷歌浏览器的那些事
    2020年第27周,24.75h,完成计算智能/物联网/数据挖掘大作业
    2020年第26周,24.75h,计算智能的大小作业
    2020年第25周,25.5h,随机过程考试、report和计算智能作业
    2020年24周,11.75h,以完成作业和考试为主,看了一点点论文
    2020年第23周,11h,努力完成课程作业
  • 原文地址:https://www.cnblogs.com/rxqq/p/13892938.html
Copyright © 2011-2022 走看看