摘要: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="www.baidu.com" android:autoLink="web" android:layout_ 阅读全文
posted @ 2016-11-03 14:58 造西 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1.try-catch实现异常捕捉 public class ExceptionDemo { public static void main(String[] args) { try { Scanner input = new Scanner(System.in); System.out.print 阅读全文
posted @ 2016-11-03 14:20 造西 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 1.包装类 public class BaoZhuangLei { public static void main(String[] args) { /* * 装箱:把基本数据类型转换为对应的对象类型 * 作用:1.在需要使用对象类型的时候,转换成对应的对象类型(在集合里面) * 2.在转换完成后, 阅读全文
posted @ 2016-11-03 14:16 造西 阅读(101) 评论(0) 推荐(0) 编辑
摘要: public class SetTest { public static void main(String[] args) { //HashSet:哈希表是通过使用称为散列法的机制来存储信息 //元素并没有以某种特定顺序来存放; HashSet<String> hs = new HashSet<St 阅读全文
posted @ 2016-11-03 14:12 造西 阅读(105) 评论(0) 推荐(0) 编辑
摘要: public class MapTest { @SuppressWarnings("rawtypes") public static void main(String[] args) { //HashMap System.out.println(" HashMap无序输出 "); HashMap<S 阅读全文
posted @ 2016-11-03 14:11 造西 阅读(87) 评论(0) 推荐(0) 编辑
摘要: public class LinkedListTest { public static void main(String[] args) { LinkedList<String> linkedList = new LinkedList<String>(); //共有的方法 linkedList.ad 阅读全文
posted @ 2016-11-03 14:10 造西 阅读(73) 评论(0) 推荐(0) 编辑
摘要: public class ArrayListTest { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<String>(); //ArrayList arrayList = n 阅读全文
posted @ 2016-11-03 14:09 造西 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 1. public class Animal { public String type; public int weight; public void shape(){ System.out.println("品种为"+type); System.out.println("体重为"+weight); 阅读全文
posted @ 2016-11-03 14:06 造西 阅读(91) 评论(0) 推荐(0) 编辑
摘要: public class CH05_1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); //第一种 String s = "helloworld"; System.out.println 阅读全文
posted @ 2016-11-03 14:03 造西 阅读(103) 评论(0) 推荐(0) 编辑
摘要: public class CH04_1 { public static void main(String[] args) { //比较两个数组是否相等 int [] num1 = {1,2,3,4,5}; int num2 [] = {1,2,3,4,5}; boolean eq = Arrays. 阅读全文
posted @ 2016-11-03 13:56 造西 阅读(164) 评论(0) 推荐(0) 编辑
摘要: for循环实现简单数字相加 public class CH03_4 { public static void main(String[] args) { int sum=0; for(int i=1,j=100; i<j;i++,j--){ sum+=i+j; } System.out.printl 阅读全文
posted @ 2016-11-03 13:55 造西 阅读(101) 评论(0) 推荐(0) 编辑
摘要: public class J {@SuppressWarnings("unused")public static void main(String[] args) { int i = 786; byte b = (byte) i; short s = (short) i; System.out.pr 阅读全文
posted @ 2016-11-03 13:49 造西 阅读(160) 评论(0) 推荐(0) 编辑
摘要: public class CH02_3 { public static void main(String[] args) { String str = "qwertweyu"; int index = str.indexOf('w'); System.out.println(index); int 阅读全文
posted @ 2016-11-03 13:49 造西 阅读(1094) 评论(0) 推荐(0) 编辑
摘要: 1.switch-case实现简单菜单登陆系统 public class Menu { public static void main(String[] args) { @SuppressWarnings("resource") Scanner input = new Scanner(System. 阅读全文
posted @ 2016-11-03 13:48 造西 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 取各位相加 public class Add { public static void main(String[] args) { int num = 8564; int gewei = num%10; int shiwei = num/10%10; int baiwei = num/100%10; 阅读全文
posted @ 2016-11-03 13:43 造西 阅读(135) 评论(0) 推荐(0) 编辑
摘要: public class Je { public static void main(String[] args) { boolean b ;//申请一个内存空间 b = false;//在内存空间存储数据 System.out.println(b); //第二种方法 int i = 32768; S 阅读全文
posted @ 2016-11-03 13:38 造西 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 1:集合框架: 接口(collection,list,set,map) 实现类(arraylist,linkedlist,hashset,treeset,hashmap,treemap) 算法(collections) 2:集合框架的接口的特点 Collection接口存储一组不唯一(可以有重复数据 阅读全文
posted @ 2016-11-03 13:32 造西 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1:接口(一个特殊的类):使用关键字interface声明,一个类可以实现多个接口 2:接口体中包含常量定义和方法定义。 (1)接口体中只有抽象方法,常量。抽象方法和常量的访问权限一定都是public。(允许省略public、final、abstract修饰符) 3:接口特性: 接口不可以被实例化 阅读全文
posted @ 2016-11-03 13:31 造西 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 继承 多态 1:继承: 关键字extends 先写父类 再编写子类,继承父类。 子类访问父类成员: 使用super关键字 2:继承后的初始化顺序: 父类属性 父类构造方法 子类属性 子类构造方法 3:有些父类成员不能继承 :: (1).不能访问父类的private成员 (2).子类与父类不在同包,使 阅读全文
posted @ 2016-11-03 13:30 造西 阅读(113) 评论(0) 推荐(0) 编辑
摘要: String: Equals方法:用来比较两个字符串是否相等 ==:用来比较两个数组的地址是否相等 String方法: Index:(判断一个字符或者字符串第一次出现的位置) LastIndexOf:(判断一个字符或者字符串最后一次出现的位置) Substring:(截取字符串) charAt:用来 阅读全文
posted @ 2016-11-03 13:29 造西 阅读(85) 评论(0) 推荐(0) 编辑