05 2016 档案

摘要:package com.hanqi.io; import java.io.*; public class IoDemo { public static void main(String[] args) { try { File file=new File("d:/testRW.txt"); if(! 阅读全文
posted @ 2016-05-31 16:05 凌零聆 阅读(287) 评论(0) 推荐(0)
摘要:package com.hanqi.io; import java.io.*; public class TextRW { public static void main(String[] args) { try { File file=new File("d:/testRW.txt"); if(! 阅读全文
posted @ 2016-05-31 15:49 凌零聆 阅读(210) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class JhSet { public static void main(String[] args) { Set<String> ss=new HashSet<>(); ss.add("A"); ss.add( 阅读全文
posted @ 2016-05-29 21:19 凌零聆 阅读(777) 评论(0) 推荐(0)
摘要:import java.util.ArrayList; public class Bai { public static void main(String[] args) { ArrayList<Integer> a=new ArrayList<>(); for (int i = 0; i < 10 阅读全文
posted @ 2016-05-28 16:46 凌零聆 阅读(228) 评论(0) 推荐(0)
摘要:package exception; public class TestException { public static void main(String[] args) { for(int i=0;i<4;i++) { try { int k; switch(i) { case 0: int z 阅读全文
posted @ 2016-05-28 15:40 凌零聆 阅读(617) 评论(0) 推荐(0)
摘要:package a; import java.util.*; public class YiChang { public static void main(String[] args) { System.out.println("输入整数:"); try { Scanner a=new Scanne 阅读全文
posted @ 2016-05-27 18:35 凌零聆 阅读(432) 评论(0) 推荐(0)
摘要:package a; public class QiuHe { private int m; private int n; public int getM() { return m; } public void setM(int m) { this.m = m; } public int getN( 阅读全文
posted @ 2016-05-27 11:34 凌零聆 阅读(1778) 评论(0) 推荐(0)
摘要:package a; public class SanWeiOuShu { public static void main(String[] args) { String str="123456789"; String a,b,c; int sum=0; for (int i = 1; i < 9; i+=2) ... 阅读全文
posted @ 2016-05-27 11:05 凌零聆 阅读(1037) 评论(0) 推荐(0)
摘要:抽象方法:在类中没有方法体的方法,就是抽象方法。 抽象类:含有抽象方法的类就叫抽象类。 抽象类中的抽象方法必须被实现!如果一个子类没有实现父类中的抽象方法,则子类也成为了一个抽象类!抽象类中的普通方法,可以不必实现。1 用abstract关键字来修饰一个类时,这个类叫做抽象类;用abstract来修 阅读全文
posted @ 2016-05-27 10:24 凌零聆 阅读(271) 评论(0) 推荐(0)
摘要:package b; public interface Computer { int computer(int n,int m); } package b; public class Jia implements Computer { @Override public int computer(in 阅读全文
posted @ 2016-05-26 18:56 凌零聆 阅读(1001) 评论(0) 推荐(0)
摘要:package a; public interface CanSwim { void swim(); } package a; public interface CanFly { void fly(); } package a; public abstract class ActionCharact 阅读全文
posted @ 2016-05-26 17:44 凌零聆 阅读(207) 评论(0) 推荐(0)
摘要:package a; public interface CentralPartyCommittee { void partyLeader(); } package a; public abstract class StateCouncil{ abstract void safetyInProduct 阅读全文
posted @ 2016-05-24 15:08 凌零聆 阅读(512) 评论(0) 推荐(0)
摘要:泛型(Generic type 或者generics)是对 Java 语言的类型系统的一种扩展,以支持创建可以按类型进行参数化的类。可以把类型参数看作是使用参数化类型时指定的类型的一个占位符,就像方法的形式参数是运行时传递的值的占位符一样。 在定义类或者接口的时候可以为类和接口指定类型形参,在定义变 阅读全文
posted @ 2016-05-23 21:40 凌零聆 阅读(181) 评论(0) 推荐(0)
摘要:package lianxi; public class Yuan { public static void main(String[] args) { double r=3.0; double circle=2*r*Math.PI; double area=Math.PI*r*r; System. 阅读全文
posted @ 2016-05-23 16:12 凌零聆 阅读(2709) 评论(0) 推荐(0)
摘要:package b; public class Car { public final static Car pinpai=new Car(); public static Car instance() { return pinpai; } public void drive() { System.o 阅读全文
posted @ 2016-05-23 14:34 凌零聆 阅读(4378) 评论(0) 推荐(0)
摘要:public class A { private int a=1; public int getA() { return a; } public void setA(int a) { this.a = a; } public void a() { System.out.println("a="+a) 阅读全文
posted @ 2016-05-23 11:07 凌零聆 阅读(853) 评论(0) 推荐(0)
摘要:package jicheng; public class Monkey { private String s; public String getS() { return s; } public void setS(String s) { this.s = s; } public Monkey(S 阅读全文
posted @ 2016-05-23 08:58 凌零聆 阅读(414) 评论(0) 推荐(0)
摘要:package a; public class Instrument { public void play() { System.out.println("弹奏乐器"); } } package a; public class Wind extends Instrument { public voi 阅读全文
posted @ 2016-05-22 23:30 凌零聆 阅读(248) 评论(0) 推荐(0)
摘要:单例对象(Singleton)是一种常用的设计模式。在Java应用中,单例对象能保证在一个JVM中,该对象只有一个实例存在。这样的模式有几个好处: 1、某些类创建比较频繁,对于一些大型的对象,这是一笔很大的系统开销。 2、省去了new操作符,降低了系统内存的使用频率,减轻GC压力。 3、有些类如交易 阅读全文
posted @ 2016-05-22 22:39 凌零聆 阅读(204) 评论(0) 推荐(0)
摘要:设计模式(Design Patterns) 设计模式(Design pattern)是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性。 毫无疑问,设计模式于己于他人于系统都是多赢的,设计模式使代码编制真正工程化, 阅读全文
posted @ 2016-05-22 22:33 凌零聆 阅读(242) 评论(0) 推荐(0)
摘要:package a; public class Chongzai { private int i; private int j; private int k; int m; public int getI() { return i; } public void setI(int i) { this. 阅读全文
posted @ 2016-05-20 21:04 凌零聆 阅读(673) 评论(0) 推荐(0)
摘要:public class Point { private int x; private int y; public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return 阅读全文
posted @ 2016-05-20 21:02 凌零聆 阅读(571) 评论(0) 推荐(0)
摘要:package a; import java.nio.charset.MalformedInputException; public class Sanjiaoxing { private double a,b,c; // public Sanjiaoxing(double a, double b, 阅读全文
posted @ 2016-05-20 20:56 凌零聆 阅读(1323) 评论(0) 推荐(0)
摘要:package lianxi; public class Yanghuisanjiao { public static void main(String[] args) { int[][] ary =new int[10][10]; for (int i = 0; i < 10; i++) { fo 阅读全文
posted @ 2016-05-20 20:53 凌零聆 阅读(222) 评论(0) 推荐(0)
摘要:package lianxi; public class Shuzunixushuchu { public static void main(String[] args) { int[] ary={1,2,3,4,5,6,7}; for (int i = ary.length-1; i >=0; i 阅读全文
posted @ 2016-05-17 15:57 凌零聆 阅读(3714) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Huiwenshu { public static void main(String[] args) { System.out.println("输入一个5位的正整数"); Scanner shu=new Scanner(System.in); String a=s... 阅读全文
posted @ 2016-05-17 15:48 凌零聆 阅读(2653) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Nixudayin { public static void main(String[] args) { System.out.println("输入一个不多于5位的正整数"); Scanner shu 阅读全文
posted @ 2016-05-17 15:37 凌零聆 阅读(1472) 评论(0) 推荐(0)
摘要:package lianxi; public class Qiuhe { public static void main(String[] args) { double sum=0,fenshu=0,a=1,b=2,c=0; for (int i = 0; i < 20; i++) { fenshu 阅读全文
posted @ 2016-05-17 15:24 凌零聆 阅读(836) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Panduantianshu { public static void main(String[] args) { int sum; while (true) { System.out.println("请输入年份... 阅读全文
posted @ 2016-05-17 15:21 凌零聆 阅读(655) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Sangeshupaixu { public static void main(String[] args) { System.out.println("请输入x的值:"); Scanner shu1= 阅读全文
posted @ 2016-05-16 14:49 凌零聆 阅读(1909) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Sanweishu { public static void main(String[] args) { String shu = "1234"; int sum = 0; for (int i = 0 阅读全文
posted @ 2016-05-16 14:27 凌零聆 阅读(984) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Zifugeshu { public static void main(String[] args) { System.out.println("输入一个字符串"); Scanner shuru=new 阅读全文
posted @ 2016-05-14 15:55 凌零聆 阅读(1472) 评论(0) 推荐(0)
摘要:package lianxi; public class Qiu { public static void main(String[] args) { double sum1 = 0, sum2 = 0, hight = 100.0; for (int i = 0; i < 10; i++) { s 阅读全文
posted @ 2016-05-14 15:03 凌零聆 阅读(22748) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Diejia { public static void main(String[] args) { System.out.println("请输入一个基数:"); Scanner jishu = new 阅读全文
posted @ 2016-05-14 14:17 凌零聆 阅读(927) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Xvexichengji { public static void main(String[] args) { System.out.println("输入姓名"); Scanner xingming 阅读全文
posted @ 2016-05-14 11:51 凌零聆 阅读(10438) 评论(0) 推荐(0)
摘要:[值类型] 也就是基本数据类型 基本数据类型常被称为四类八种 四类: 1.整型 2.浮点型 3.字符型 4.逻辑型 八种: 1.整型4种 byte 1字节 -128——127 short 2 字节 -32,768 —— 32,767 int 4 字节 -2,147,483,648 ——2,147,4 阅读全文
posted @ 2016-05-13 21:40 凌零聆 阅读(152) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class kaishihejiewei { public static void main(String[] args) { System.out.print("请输入字符:"); Scanner str = new Scanner(System.in); ... 阅读全文
posted @ 2016-05-13 21:12 凌零聆 阅读(537) 评论(0) 推荐(0)
摘要:import java.util.*; public class Erfen { public static void main(String[] args) { int ary[] = new int[10]; Random a = new Random(); for (int i = 0; i ary[j + 1]) { ... 阅读全文
posted @ 2016-05-13 15:14 凌零聆 阅读(152) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Yanzhengma { public static void main(String[] args) { String str="abcdefghijklmnopqrstuvwxyzABCDEFGHI 阅读全文
posted @ 2016-05-12 21:04 凌零聆 阅读(123) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Suijishu { public static void main(String[] args) { int ary[]=new int[6]; for (int i = 0; i <6; i++) { ... 阅读全文
posted @ 2016-05-11 14:11 凌零聆 阅读(232) 评论(0) 推荐(0)
摘要:一.java.lang.Math.random() 在使用这一静态方法的时候,我们不需要import任何包,因为java.lang.*包是默认载入的,下面举例说面使用方法: 二.创建java.util.Random对象 阅读全文
posted @ 2016-05-10 20:57 凌零聆 阅读(318) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Erfenchazhao { // 网上查到的方法 public static int halfSearch(int a[], int x) { int mid, left, right; left = 0; right = a.length - ... 阅读全文
posted @ 2016-05-10 20:41 凌零聆 阅读(164) 评论(0) 推荐(0)
摘要:package lianxi; import java.util.*; public class Maopaopaixu { public static void main(String[] args) { //输入数字 并把数字插入数组中 Scanner shu=new Scanner(Syste 阅读全文
posted @ 2016-05-10 11:29 凌零聆 阅读(172) 评论(0) 推荐(0)
摘要:double jiecheng=1; double sum=0; int j=0; for (int i = 1; i <=20; i++) { do { j++; jiecheng=jiecheng*j; } while (j<i); // System.out.println(jiecheng) 阅读全文
posted @ 2016-05-09 13:29 凌零聆 阅读(387) 评论(0) 推荐(0)
摘要:int i=0; int jiecheng=1; do { i++; jiecheng=jiecheng*i; } while (i<5); System.out.println("5的阶乘为"+jiecheng); 阅读全文
posted @ 2016-05-09 13:27 凌零聆 阅读(375) 评论(0) 推荐(0)
摘要://统一单位 double sum=0.00008; int i=0; while (true) { if(sum<8848.13) { i++; sum=sum*2; continue; } if(sum>=8848.13) System.out.println("对折"+i+"次为"+sum+" 阅读全文
posted @ 2016-05-09 13:24 凌零聆 阅读(4016) 评论(0) 推荐(0)
摘要://三角形 for (int i = 1; i < 6; i++) { for (int j = 1; j <=i; j++) { System.out.print("△"); } System.out.println(); } System.out.println(); //菱形 for (int 阅读全文
posted @ 2016-05-08 15:18 凌零聆 阅读(482) 评论(0) 推荐(0)
摘要:for (int i = 1; i < 10; i++) { for (int j = 1; j <=i; j++) { int s=j*i; System.out.print("\t"+j+"*"+i+"="+s); } System.out.println(); } 阅读全文
posted @ 2016-05-08 14:34 凌零聆 阅读(105) 评论(0) 推荐(0)
摘要://直接取各种马最多都是100匹 //也可以计算得:大马100/3取整得33匹;中马100/2=50匹;小马只能取最多100匹 for (int i = 0; i <=100; i++) { for (int j = 0; j <=100; j++) { for (int k = 0; k <=10 阅读全文
posted @ 2016-05-08 14:31 凌零聆 阅读(207) 评论(0) 推荐(0)
摘要://100文钱最多可以买100/5=20只公鸡 //100文钱最多可以买100/3 取整为33只母鸡 //100文钱最多金额义卖买100*3=300只雏鸡 最多100只 取最多100只雏鸡 //也可以直接全部取最多100只 for (int i = 0; i <=20; i++) { for (in 阅读全文
posted @ 2016-05-08 14:18 凌零聆 阅读(206) 评论(0) 推荐(0)
摘要:for (int i = 1; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k= 0; k <10; k++) { if((i*100+j*10+k)==(i*i*i+j*j*j+k*k*k)) { System.out.printl 阅读全文
posted @ 2016-05-08 13:38 凌零聆 阅读(135) 评论(0) 推荐(0)
摘要:ASCII码(Dec 十进制 Hx 十六进制 Oct 八进制) 阅读全文
posted @ 2016-05-07 08:48 凌零聆 阅读(183) 评论(0) 推荐(0)
摘要:无标题文档 阅读全文
posted @ 2016-05-06 14:56 凌零聆 阅读(1082) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2016-05-06 14:46 凌零聆 阅读(171) 评论(0) 推荐(0)
摘要:1几个最重要的快捷键 代码助手:Ctrl+Space(简体中文操作系统是Alt+/)快速修正:Ctrl+1单词补全:Alt+/打开外部Java文档:Shift+F2显示搜索对话框:Ctrl+H快速Outline:Ctrl+O打开资源:Ctrl+Shift+R打开类型:Ctrl+Shift+T显示重构 阅读全文
posted @ 2016-05-05 15:14 凌零聆 阅读(176) 评论(0) 推荐(0)
摘要:环境变量 环境变量(environment variables)一般是指在操作系统中用来指定操作系统运行环境的一些参数,如:临时文件夹位置和系统文件夹位置等。 环境变量是在操作系统中一个具有特定名字的对象,它包含了一个或者多个应用程序所将使用到的信息。例如Windows和DOS操作系统中的path环 阅读全文
posted @ 2016-05-04 15:11 凌零聆 阅读(232) 评论(0) 推荐(0)
摘要:public class Hello { public static void main(String[] args) { // TODO 自动生成的方法存根 System.out.println("大家好"); } } 阅读全文
posted @ 2016-05-04 10:33 凌零聆 阅读(269) 评论(1) 推荐(0)
摘要:class Hello { public static void main(String[] args) { System.out.println("Hello World!!!"); } } 阅读全文
posted @ 2016-05-03 21:10 凌零聆 阅读(178) 评论(0) 推荐(0)
摘要:网页三部分内容:HTML CSS Javascript 一般做网页时用相对路径。 images/aaa.jpg 网页同一个目录中找images文件夹,再在images文件夹中找aaa.jpg images/1000/aaa.jpg 网页同一个目录中找images文件夹,再在images文件夹中找10 阅读全文
posted @ 2016-05-03 15:20 凌零聆 阅读(129) 评论(0) 推荐(0)