A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© kkkkkccccc 中级黑马   /  2015-7-22 23:34  /  658 人查看  /  14 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

一、Scanner
Int nextInt();
String nextLine();
二、Math
1.int abs(int i) //绝对值
2.int max(int a,int b)//最大值
3.int min(int a,int b)//最小值
4.double random() //[0.0 1.0);
5.double ceil(double x)向上取整 天花板数 13.4  14
6.double floor(double y)向下取整 地板数
7.int round(float i) //四舍五入
8.double pow(double a , double b) //a的b次幂
9.double sqrt(double a)//开放
三、random
1.int nextInt(int n) //[0 n)
四、String
1.构造
String();
String (byte[] bytes)
String (byte[] bytes , int fromIndex ,int length)
String(char[] chars)
String (char[] chars, int fromIndex ,int length)
String(string str)
String(StringBuffer sb)
 
2.判断
equals(Object obj).//判断两个字符串是否相等,区分大小写
equalsIgnoreCase(String other) //不区分大小写判断
Contains(String str) //是否包含指定字符
startWith(string str)
endWith(string str)
isEmpty()  //判断字符串是否为空 也就是 length()=0
3.获取
Char charAt(int index)//得到索引位置的字符
length()//获取字符串长度
Int indextOf(String str)//获取字符串str在大串中第一次出现的索引位置
Int indexOf(char ch)//获取ch第一次出现的索引位置
Int indexOf(string subStr,int fromIndex)//从指定位置开始,获取substr第一次出现的位置
Int indexOf(char ch, int formIndex)
String subString(int start)//从start开始截取字符串到末尾
String subString (int start,int end)//截取字符串指定的区间包左不包右。。。。注意 对原来的字符串没有影响,返回一个新的字符串对象
4.转换
Byte [] getBytes()//转换成字节数组
Char[] toCharArray()//转换成字符数组
String  copyValueOf(char[] chs)//
String valueOf(Object obj)//把任意类型转换为字符串
String toLowerCase()//字符串全部转换成小写
String toUpperCase()//字符串转换成大写
String concat()//字符串拼接
5.其他功能
String replace(char oldch,char newch)//替换功能
String replace(String oldStr,String newStr)
String trim();
String[] split(string regex)//按照regex切割字符串返回字符数组
Int compareTo(String str)//按照字典顺序比较两个字符串
Int compareToIgnoreCase(String str)//忽略大小写
五、Object
1.String toString()//默认返回对象的地制值,一般要重写
2.boolean equals(Object obj)//默认比较两个对象的地址值
 
六、Arrays
1.String toString(Objec[] a)//打印数组
2.void sort()//排序 快速排序
3.int binarySearch(Object[]a,int value) //二分查找
七、System
1.void exit(int statusCode)//退出
2.long currentTimeMillis()//获取当前时间的毫秒值
3.void  arraycopy(Object[] srcObjs,int fromIndex,Object[] desobj ,int fromIndx2,int length)//复制数组
八、StringBuffer
1.构造方法
StringBuffer()//初始值 16
StringBuffer(int capacity)//指定容量
StringBuffer(String str)//
2.添加功能
StringBuffer append(String str)//末尾追加内容
StringBuffer insert(int index,String str)//指定位置插入
3.删除
StringBuffer deleteCharAt(int index)
StringBuffer delete(int start,int end)//删除一个区间
4.反转
StringBuffer reverse()//反转字符串,影响
5.其他
StringBuffer replace(int start,int end,String new)//替换  对Buffer有影响
String subString(int start)
String subString(itn start,int end)
九、Integer
1.static intpaseInt(String strnumber)//
2.Integer进制转换
toBinarryString()2
toOctaString()8
toHexString()16
3.构造方法
Integer(int i);
integer(int value)
Integer(String s) 注意:这里的字符串必须是由数字字符组成的字符串
NumberFormatException:数据异常
4.转换
Int-----String
1.String s1=100+"";
2.String s2=string .valueOf(100);
3.Int-----Integer----integer.tostring---string
4.public static String tostring
Integer .toString()
String----int
1.String----integer----int
Integer ii=new Integer(s)
Int i=ii.intValue();
2.int number2=Integer.parseInt(s); parseInt 是静态的方法
 
 
十、Date类的使用:
构造方法:
Date()
Date(long tim)
成员方法:
Date---Long 通过日期获取毫秒值
Date d=new date();
Long time=d.getTiem()
Long----Date通过毫秒值获取日期对象
Long time=??;
Date d=new date(time)
 
Date d=new date();
d.steTime(time);
 
Public long getTime() 获取时间毫秒值
Public void setTime(long time)设置一个毫秒值 然后  
 
十一、DateFormat(抽象类)
对日期进行格式化的类,提供了对日期进行格式化,和对字符串进行解析的功能
格式化:日期对象-----文本,  date---string
Date----String
Public final String format(Date d
ate)
需要自己指定格式:
构造方法 simpleDateformat(String fomate)
常见格式:
yyyy年MM月dd日 HH:mm:ss
 
解析:   文本------对象,String---date
Public Date parse(String source)
如果是字符串到日期,你指定的格式必须和字符串的格式匹配
    1.子类  simpleDateFormat
构造方法:
SimpleDateFormat():有默认模式
默认模式不是我们想要的,所以我们指定模式:
simpleDateFormat(String format)指定格式
十二、Calendar
calendar:处理时间的
在日历字段和calendar之间提供转换功能
从calendar中获取任意一个日历字段,然后按照我需要的进行任意排列
 
Public static calendar getInstance();d多态得到子类,
得到对象:
Calendar c=Calendar.getInstance();多态
 
成员方法
Public static final int Year 直接用类来调用
Public  int get (int field):参数是日历字段
Public final void set(int year,int month,int day) 注意:给的月份是2月实际是3月份,月份是从0开始的
Public abstract void add(int filed,int amount) 添加减去时间量
 

评分

参与人数 1黑马币 +6 收起 理由
Miss.H + 6 很给力!

查看全部评分

14 个回复

倒序浏览
不错不错,,,
回复 使用道具 举报
这个很好,多谢啦
回复 使用道具 举报
很有用,值得一看!!!!!!!!!!!!!!!!!!!1
回复 使用道具 举报
我们宿舍学习UI已经毕业的现在还在做作品0.0  但是我好困0.0
回复 使用道具 举报
都是比较重要的,不错。
回复 使用道具 举报
多谢楼主分享!
回复 使用道具 举报
shero 中级黑马 2015-7-31 08:23:12
8#
太好了,谢谢分享
回复 使用道具 举报
楼主 这个牛逼啊
回复 使用道具 举报
学习了!!!
回复 使用道具 举报
很全,但是要是能突出一下重点就更好了。
回复 使用道具 举报
学习了!!!
回复 使用道具 举报
回复 使用道具 举报
赞!!!!!!!!!!
回复 使用道具 举报
谢谢楼主分享。才刚刚开始学习api,这些内容中有哪些是需要重点学习掌握的啊
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马