摘要: <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 造西 阅读(136) 评论(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 造西 阅读(65) 评论(0) 推荐(0)
摘要: 1.包装类 public class BaoZhuangLei { public static void main(String[] args) { /* * 装箱:把基本数据类型转换为对应的对象类型 * 作用:1.在需要使用对象类型的时候,转换成对应的对象类型(在集合里面) * 2.在转换完成后, 阅读全文
posted @ 2016-11-03 14:16 造西 阅读(107) 评论(0) 推荐(0)
摘要: public class SetTest { public static void main(String[] args) { //HashSet:哈希表是通过使用称为散列法的机制来存储信息 //元素并没有以某种特定顺序来存放; HashSet<String> hs = new HashSet<St 阅读全文
posted @ 2016-11-03 14:12 造西 阅读(115) 评论(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 造西 阅读(91) 评论(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 造西 阅读(76) 评论(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 造西 阅读(87) 评论(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 造西 阅读(95) 评论(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 造西 阅读(114) 评论(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 造西 阅读(176) 评论(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 造西 阅读(106) 评论(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 造西 阅读(171) 评论(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 造西 阅读(1113) 评论(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 造西 阅读(155) 评论(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 造西 阅读(141) 评论(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 造西 阅读(102) 评论(0) 推荐(0)
摘要: 1:集合框架: 接口(collection,list,set,map) 实现类(arraylist,linkedlist,hashset,treeset,hashmap,treemap) 算法(collections) 2:集合框架的接口的特点 Collection接口存储一组不唯一(可以有重复数据 阅读全文
posted @ 2016-11-03 13:32 造西 阅读(124) 评论(0) 推荐(0)
摘要: 1:接口(一个特殊的类):使用关键字interface声明,一个类可以实现多个接口 2:接口体中包含常量定义和方法定义。 (1)接口体中只有抽象方法,常量。抽象方法和常量的访问权限一定都是public。(允许省略public、final、abstract修饰符) 3:接口特性: 接口不可以被实例化 阅读全文
posted @ 2016-11-03 13:31 造西 阅读(77) 评论(0) 推荐(0)
摘要: 继承 多态 1:继承: 关键字extends 先写父类 再编写子类,继承父类。 子类访问父类成员: 使用super关键字 2:继承后的初始化顺序: 父类属性 父类构造方法 子类属性 子类构造方法 3:有些父类成员不能继承 :: (1).不能访问父类的private成员 (2).子类与父类不在同包,使 阅读全文
posted @ 2016-11-03 13:30 造西 阅读(118) 评论(0) 推荐(0)
摘要: String: Equals方法:用来比较两个字符串是否相等 ==:用来比较两个数组的地址是否相等 String方法: Index:(判断一个字符或者字符串第一次出现的位置) LastIndexOf:(判断一个字符或者字符串最后一次出现的位置) Substring:(截取字符串) charAt:用来 阅读全文
posted @ 2016-11-03 13:29 造西 阅读(88) 评论(0) 推荐(0)
摘要: 面向对象(类和对象) 1.类是对象的描述,对象是类的个体;类是抽象的,对象是具体的。 2.定义类和对象 编程步骤: 定义类:三步:(发现类,发现类的属性,发现类的方法) 构造对象(用类实例化对象) 使用对象() 3:类的格式 类 class 类名{} 属性 数据变量 变量名; 方法 void 返回值 阅读全文
posted @ 2016-11-03 13:29 造西 阅读(81) 评论(0) 推荐(0)
摘要: 1:数组:保存一组相同数据类型的集合 1:内存空间连续 2:内存大小是固定的 3;有索引,有首地址(数组名称) 声明数组的同时进行赋值(最简单):int [] nums = {1,2,3,4,5,6}; 2:数组的工具类:Arrays类 1:sort(对数组进行升序排列) 2:fill(对数组进行赋 阅读全文
posted @ 2016-11-03 13:28 造西 阅读(111) 评论(0) 推荐(0)
摘要: 1:顺序结构 2:选择结构 If、if else、if else if else if else、swicth case(break) 3:循环结构 For (循环变量的声明;循环条件的判断;循环变量的更新) While (先判断,再执行) Do while (先执行,再判断) 增强for循环(遍历 阅读全文
posted @ 2016-11-03 13:27 造西 阅读(545) 评论(0) 推荐(0)
摘要: 1:标识符:在程序里给类,对象,方法,属性等起的名字 标识符由大小写字母,下划线,数字,$符号组成 开头可以是大小写字母,下划线和$符号,数字不能开头 标识符长度没有限制 不能有关键字和保留字 命名最好能体现其作用 Java对字母大小写有严格要求 2:数据类型分类 2.1:基本数据类型:数值型(整数 阅读全文
posted @ 2016-11-03 13:26 造西 阅读(429) 评论(0) 推荐(0)
摘要: 1:ava:面向对象的编程语言 2:Java版本: JAVA SE 标准版 JAVA EE 企业版 JAVA ME 微小版 3:安装jdk (jre jvm) 配置环境变量 (JavaHome) Jdk:java开发程序包 jre:java运行环境 jvm:java虚拟机 4:用txt文档编写jav 阅读全文
posted @ 2016-11-03 13:24 造西 阅读(140) 评论(0) 推荐(0)