- 使可变性最小化--EffectiveJava小结(15)
冰鱼飞鸟
不可变类:每个实例的所有属性都必须再创建该实例时就提供,并且再对象的整个生命周期内固定不变。不可变类的五个规则:1.不提供任何修改属性的方法。2.保证类不会被扩展。(不是不能子类化,而是为了防止调用者将其子类化)3.所有属性都是final修饰。4.所有属性都私有。(1.当属性是可变对象时候,防止调用方获取该可变对象并且修改了其属性。2.通过方法比直接提供属性更灵活,方法可以修改其内部实现)5.确保
- Java小结3——面向对象进阶
往前狂奔的Stephen
java开发语言
目录类就是设计图构造器this关键字工具类代码块设计模式包final关键字的作用常量枚举static关键字成员方法的分类方法的内存原理抽象类接口接口新增的方法多态内部类静态内部类成员内部类局部内部类(了解即可)匿名内部类常用APIObject类StringBuilderMath类System类Date类两个小算法Lambda表达式包装类面向对象复习补漏类就是设计图类就是建造对象的蓝图。定义类的注意
- 重写equals方法时要遵循通用约定--EffectiveJava小结(8)
冰鱼飞鸟
不覆盖(重写)equals的情况下:只有s1==s2,才有s1.equals(s2).Object中equals的实现如下:publicbooleanequals(Objectobj){return(this==obj);}重写equals方法要遵循的通用约定有1.自反性:对于非null对象x,有x.equals(x)==true.如果违反了自反性,集合的contains方法就无法判断该对象已经存
- 初识Java小结
鹿白_tz
一:Java简介1:什么是javajava是一种跨平台、面向对象的程序设计语言。用它编写的程序可以在任何在任何计算机、操作系统和支持java的硬件设备上运行。java是一种通过解释方式来执行的语言,是一门非常卓越的编程语言。2:java的版本JavaSEJava平台标准版((JavaStandardEnterpriseEdition)),为用户提供一个程序开发环境。这个程序开发环境提供了开发与运行
- 避免创建不必要的对象--EffectiveJava小结(5)
冰鱼飞鸟
尽量重用对象,而不是重新创建。一.重用不可变对象不可变对象,始终可以被重用。如String//尽量用,多次调用不会重复创建对象Strings="";//而不是,调多少次就创建多少次对象Strings2=newString("");另外调用静态工厂方法优于调用构造器。如Boolean.valueOf(String);优于newBoolean(String)因为前者会返回Boolean中缓存的true
- Java小结
Smile丶微笑
一、线程部分1、Java中引用类型都有哪些?(1)强引用。在虚拟机内存不足的情况下,也不会回收,如果我们把(强引用)对象置为null,会大大增加了垃圾回收的频率。几乎只要我们给出建议(GC),JVM就会回收。Objecto=newObject();Objecto1=o;(2)软引用。如果不显式的置为null,跟强引用差不多。垃圾回收不会执行。只会等到内存不足的时候才会调用。(3)弱引用。就算不置为
- SpringBoot开发实用篇 - 测试 - 加载测试专用配置,测试类中启动web环境,发送虚拟请求模拟
鬼鬼骑士
Java开发必备成长阶段springboot前端java
文章目录加载测试专用配置案例演示编写ConfigrationTest.java编写MsgConfig.java小结测试类中启动web环境案例演示编写xml编写WebTest.java测试运行小结发送虚拟请求案例模拟新建UserController.java运行测试案例模拟2编写WebTest.java测试运行小结加载测试专用配置有效解决配置冲突问题案例演示编写ConfigrationTest.ja
- Spring框架从入门到精通
cgblpx皮皮霞
3-SSM三大框架springjava
文章目录初识Spring框架时代变迁Spring的野心官网框架组成核心概念三大核心组件的关系主要jar组成Spring框架两大核心:IoC和DI概念IoCDIIoC的XML方式创建springboot工程创建Hello.java创建applicationContext.xml创建TestIoC.java小结IoC的注解方式创建springboot工程pom.xmlHello.javaapplica
- java小结
夜幕繁华
八大基本变量boolean--1bitbyte--8bitshort--16bitint--32bitlong--64bitchar--16bitfloat--32bitdouble--64bit条件和循环语句1.if语句语法说明:if是该语句中的关键字,后续紧跟一对小括号,该对小括号任何时候不能省略,小括号的内部是具体的条件,语法上要求该表达式结果为boolean类型。后续为功能的代码,也就是当
- 构造器参数较多时考虑使用构建器(Builder)--EffectiveJava小结(2)
冰鱼飞鸟
遇到大量参数(必要参数/可选参数)的可选方案:1.重叠构造器模式classTest{privateintparam1;privateStringparam2;privateintparam3;Test(intparam1){this(param1,null);}Test(intparam1,Stringparam2){this(param1,param2,0);}Test(intparam1,St
- Java小结(二)——打印矩形和九九乘法表
莫陌莫墨
java函数矩形九九乘法表
我们经常打印各种各样的三角形,今天我们打印一个矩形,顶一个定义一个函数,函数功能就是打印矩形,这样,以后我们想打印几行几列的矩形都是可以的,。如何定义一个函数呢?通过两个明确来完成明确一:这个功能的结果是什么?明确二:这个功能实现过程是否需要未知内容参与。很明显我是要打印矩形,结果是返回来一个打印好的矩形,类型是void。这个过程实现,我们需要未知的内容参与,row和col,即行和列。public
- Java小结(一)——打印等腰三角形
莫陌莫墨
Java
一开始我们学习Java、C、python等语言的时候,都是从基本语法开始的,一些基本的循环语句,实现一些简单的小的练习需求。比如打印等腰三角形。打印一个如下形式的等腰三角形:/******************/那我们初学者可能一开始就会想到的是最简单粗暴地一个算法,我直接System.out.print(),一行行的给打印出来,例如System.out.print("*");System.ou
- Java小结
明天争取
Javajavahibernatespring
Java小结一、请解释什么是pojo类,它有什么要求:答:1、pojo类是和一张表对应2、一般我们放在com.xxx.domain下3、pojo需要一个主键属性(用于标示一个pojo对象)4、除了主键属性外,它应当还有其它属性,属性的访问权限是private5、提供set/get方法6、它应当有一个无参的构造方法(hibernate反射)7、pojo类其实就是javabean二、在spring框架
- 用私有构造器或枚举类型强化单例(Singleton)属性--EffectiveJava小结(3)
冰鱼飞鸟
用私有构造器或枚举类型目的都是为了保证单例。但是如果要考虑反射和反序列的方式创建对象,则还需要额外的工作。一.非枚举类型实现的单例(1)防止实现Serializable的序列化,反序列化破坏单例:需要声明一个readResolve方法,ObjectInputStream.readObject()返回的对象会是readResolve的返回对象。ps:实际上是反序列化生成新对象后再调用了这个对象的re
- 初识Java小结
JA尐白
小结1:数据基本类型————Java中一切数据和运算的基础本章中两个主线就是Java基本数据类型和Java基本基本运算符。1、介绍了基本数据类型的值域。8种基本数据类型都有自己的值域,因为这些数据是保存在计算机里的,不能像数学中那样有无限个值。2、每种基本变量的名字都是Java中的关键字。3、在Java中,把有理数称为浮点数。浮点数在Java中是使用近似的值进行表达的。浮点数的这个性质影响了比较两
- Rxjava小结
吴小博Toby
byhzwusibo20190504http://gank.io/post/560e15be2dca930e00da1083?from=timeline&isappinstalled=0#toc_1RxJava:异步。好在:简洁。RxJava是通过一种扩展的观察者模式来实现异步的。优雅的实现方法-基于事件流的链式调用flatMap()和map()有一个相同点:它也是把传入的参数转化之后返回另一个对
- java小结
花飞月
在开发过程中遇到的各种bug。一、BigDecimal转json时候会丢失精度问题在前台页面data中的BigDecimal数据类型,比如0.0000会变为0,导致精度丢失。data:JSON.stringify(data),解决方法newDecimalFormat("#0.0000").format(map.get("percent"));--指定保留四位小数二、在求概率问题时,两个long型相
- Java小结
小小白心里软
SERIES
DOS命令(理解)(1)切换盘符(掌握)d:回车(2)显示某目录下的所有文件或者文件夹(掌握)dir回车(3)创建文件夹md文件夹名称回车(4)删除文件夹rd文件夹名称回车(5)进入目录(掌握)单级进入cd目录名称多级进入cd目录名称1\目录名称2…(6)回退目录(掌握)单级回退cd…回退根目录cd(7)删除文件del文件名称*.txt可以表示多个文件名称(8)清屏(掌握)cls(9)退出exi
- Java小结(三)——打印完美杨辉三角
莫陌莫墨
Javafor循环杨辉三角
打印了一个10层的等腰杨辉三角//打印杨辉三角publicstaticvoidprintTrigon(){int[][]a=newint[10][10];//定义一个二维数组,用来打印十层的杨辉三角for(inti=0;i<10;i++){a[i][i]=1;//首尾都是1,利用for循环,打印出边界值a[i][0]=1;}/*从第三层开始,等于肩部的两边值相加*/for(inti=2;i<10;
- Java小结
Start___Over
不知不觉中,Java的基础内容已经学完了,剩下也就两个月左右的时间了,感觉在这段java的基础内容里学的更加的蒙了,学完以后还是不会运用。学前面的知识时间花的也比较长,有些知识也会反复的讲,听得多了自然而然的就会懂了,而且那时候的知识点相对而言简单一点,自己琢磨一下,上网查查资料就会明白,课后练习的时间也多,多敲几遍老师上课的代码就能够可以用了。现在学完的Java内容,理解上有点困难,上课的进度也
- JAVA小结
qq_29513775
java01
基本概念1.JDK,JRE,JVM的作用及关系(1)作用JVM:保证Java语言跨平台JRE:Java程序的运行环境JDK:Java程序的开发环境(2)关系JDK:JRE+工具JRE:JVM+类库2.名词解释:2.1关键字:被Java语言赋予特定含义的单词。编程中全部小写;goto和const作为保留字存在。2.2标识符:就是给类,接口,方法,变量等起名字的字符序列。2.3注释:解释说明程序,提高
- java小结
java
我在编写mapreduce程序的时候,测试数据是两个矩阵,每一个矩阵分别存放在一个文件中,文件的每一行是一个三元组(i,j,mij)。
后来一不小心在文件的最后一行多敲了一个回车,在程序中读取文件数据的时候出现数据格式异常的问题,并且影响了程序的正常运行。
String line=val
- java小结1
JavaChaoCo
java编程对象Class多态
1、jdk:开发包javaIDE:java集成开发环境2、如何设置环境变量? 我的电脑------高级------环境变量------系统变量------新建 变量名-----classpath(告诉虚拟机)-----java类文件所在的路径 变量名-----path(告诉windows)---------3、熟悉jdk常用的命令: java: 执行class文件,关联控制台 j
- 寒假自学JAVA小结
u013390476
javaeclipsejdk线程语言
大二的寒假只剩下一周时间了,日子过得真快。我之前利用了一部分时间,学起了JAVA。JAVA是目前世界上最流行的语言,我也希望我能早一点入门JAVA。JAVA是一门几乎完全面对象的语言(除了内置类型int,double,char之类的。其实JAVA有类型封装器,int也能变成一个类Integer)。关于类,封装,继承,多态等概念,在我在学校学习C++的时候已经深入人心。扎实的C++基本功,让我在学习
- 黑马程序员——java小结_007_单例设计模式(懒汉式、饿汉式)
DeathOrRebirth
java懒汉式饿汉式单例设计模式
-------android培训、java培训、期待与您交流!----------为了方便和安全,java的先辈们总结了n多模式,懒汉式和饿汉式就是其中常用的。 此模式目的:整个应用中有且只有一个实例,所有指向该类型实例的引用都指向这个实例。 要保证对象唯一性1.为了避免其他程序过多建立该对象,先禁止其他程序建立该类对象。2.为了让其他程序可以访问该对象,只好在本类中,自定义一个对象
- Java小结
champion_netjava
Java多线程Matlab数据结构游戏java小结
[b]一.继承,多态,重写[/b][u]1.继承:[/u]降低工作量,降低程序的复杂性,使程序提高可扩展性......一个类继承另一个类(一个接口继承另一个接口)的关键字是extends,类之间的继承只能一对一,不能继承多个类。继承的格式:publicclass子类名extends父类名{}一个类继承接口的关键字是implements;一个类可以继承多个接口,接口之间用逗号隔开;继承的格式:pub
- Java小结
沈冠军
java多线程数据结构游戏matlab
一.继承,多态,重写
1.继承 :降低工作量,降低程序的复杂性,使程序提高可扩展性......
一个类继承另一个类(一个接口继承另一个接口)的关键字是extends,类之间的继承只能一对一,不能继承多个类。
继承的格式:public class 子类名 extends 父类名{}
一个类继承接口的关键字是implements;一个类可以继承多个接口,接口之间用逗号隔开;
继承的格式:
- Java小结第一篇(枚举应用)
kadenSH
java框架strutsF#mobile
菜鸟新篇
实习期结束了,写过那么多代码,最近等毕业答辩,有空余时间,也有动力,来回忆开发过程的点点滴滴,权当为自己做总结,积累自己的代码库.若您觉得内容太浅,希望您给予我些许点拨,我将感激不尽,助人者必有好报. 从能想起来的最近的往回倒推吧. 相信很多人有过这样的经历,特别是做j2ee(B/S)的时候, 当从页面传过来一个参数,无论是servlet或者str
- corejava小结 2009年5月9日
hanwesley
java设计模式编程应用服务器D语言
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.
- springmvc 下 freemarker页面枚举的遍历输出
杨白白
enumfreemarker
spring mvc freemarker 中遍历枚举
1枚举类型有一个本地方法叫values(),这个方法可以直接返回枚举数组。所以可以利用这个遍历。
enum
public enum BooleanEnum {
TRUE(Boolean.TRUE, "是"), FALSE(Boolean.FALSE, "否");
- 实习简要总结
byalias
工作
来白虹不知不觉中已经一个多月了,因为项目还在需求分析及项目架构阶段,自己在这段
时间都是在学习相关技术知识,现在对这段时间的工作及学习情况做一个总结:
(1)工作技能方面
大体分为两个阶段,Java Web 基础阶段和Java EE阶段
1)Java Web阶段
在这个阶段,自己主要着重学习了 JSP, Servlet, JDBC, MySQL,这些知识的核心点都过
了一遍,也
- Quartz——DateIntervalTrigger触发器
eksliang
quartz
转载请出自出处:http://eksliang.iteye.com/blog/2208559 一.概述
simpleTrigger 内部实现机制是通过计算间隔时间来计算下次的执行时间,这就导致他有不适合调度的定时任务。例如我们想每天的 1:00AM 执行任务,如果使用 SimpleTrigger,间隔时间就是一天。注意这里就会有一个问题,即当有 misfired 的任务并且恢复执行时,该执行时间
- Unix快捷键
18289753290
unixUnix;快捷键;
复制,删除,粘贴:
dd:删除光标所在的行 &nbs
- 获取Android设备屏幕的相关参数
酷的飞上天空
android
包含屏幕的分辨率 以及 屏幕宽度的最大dp 高度最大dp
TextView text = (TextView)findViewById(R.id.text);
DisplayMetrics dm = new DisplayMetrics();
text.append("getResources().ge
- 要做物联网?先保护好你的数据
蓝儿唯美
数据
根据Beecham Research的说法,那些在行业中希望利用物联网的关键领域需要提供更好的安全性。
在Beecham的物联网安全威胁图谱上,展示了那些可能产生内外部攻击并且需要通过快速发展的物联网行业加以解决的关键领域。
Beecham Research的技术主管Jon Howes说:“之所以我们目前还没有看到与物联网相关的严重安全事件,是因为目前还没有在大型客户和企业应用中进行部署,也就
- Java取模(求余)运算
随便小屋
java
整数之间的取模求余运算很好求,但几乎没有遇到过对负数进行取模求余,直接看下面代码:
/**
*
* @author Logic
*
*/
public class Test {
public static void main(String[] args) {
// TODO A
- SQL注入介绍
aijuans
sql注入
二、SQL注入范例
这里我们根据用户登录页面
<form action="" > 用户名:<input type="text" name="username"><br/> 密 码:<input type="password" name="passwor
- 优雅代码风格
aoyouzi
代码
总结了几点关于优雅代码风格的描述:
代码简单:不隐藏设计者的意图,抽象干净利落,控制语句直截了当。
接口清晰:类型接口表现力直白,字面表达含义,API 相互呼应以增强可测试性。
依赖项少:依赖关系越少越好,依赖少证明内聚程度高,低耦合利于自动测试,便于重构。
没有重复:重复代码意味着某些概念或想法没有在代码中良好的体现,及时重构消除重复。
战术分层:代码分层清晰,隔离明确,
- 布尔数组
百合不是茶
java布尔数组
androi中提到了布尔数组;
布尔数组默认的是false, 并且只会打印false或者是true
布尔数组的例子; 根据字符数组创建布尔数组
char[] c = {'p','u','b','l','i','c'};
//根据字符数组的长度创建布尔数组的个数
boolean[] b = new bool
- web.xml之welcome-file-list、error-page
bijian1013
javaweb.xmlservleterror-page
welcome-file-list
1.定义:
<welcome-file-list>
<welcome-file>login.jsp</welcome>
</welcome-file-list>
2.作用:用来指定WEB应用首页名称。
error-page1.定义:
<error-page&g
- richfaces 4 fileUpload组件删除上传的文件
sunjing
clearRichfaces 4fileupload
页面代码
<h:form id="fileForm"> <rich:
- 技术文章备忘
bit1129
技术文章
Zookeeper
http://wenku.baidu.com/view/bab171ffaef8941ea76e05b8.html
http://wenku.baidu.com/link?url=8thAIwFTnPh2KL2b0p1V7XSgmF9ZEFgw4V_MkIpA9j8BX2rDQMPgK5l3wcs9oBTxeekOnm5P3BK8c6K2DWynq9nfUCkRlTt9uV
- org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1解决方案
白糖_
Hibernate
文章摘自:http://blog.csdn.net/yangwawa19870921/article/details/7553181
在编写HQL时,可能会出现这种代码:
select a.name,b.age from TableA a left join TableB b on a.id=b.id
如果这是HQL,那么这段代码就是错误的,因为HQL不支持
- sqlserver按照字段内容进行排序
bozch
按照内容排序
在做项目的时候,遇到了这样的一个需求:
从数据库中取出的数据集,首先要将某个数据或者多个数据按照地段内容放到前面显示,例如:从学生表中取出姓李的放到数据集的前面;
select * fro
- 编程珠玑-第一章-位图排序
bylijinnan
java编程珠玑
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Random;
public class BitMapSearch {
- Java关于==和equals
chenbowen00
java
关于==和equals概念其实很简单,一个是比较内存地址是否相同,一个比较的是值内容是否相同。虽然理解上不难,但是有时存在一些理解误区,如下情况:
1、
String a = "aaa";
a=="aaa";
==> true
2、
new String("aaa")==new String("aaa
- [IT与资本]软件行业需对外界投资热情保持警惕
comsci
it
我还是那个看法,软件行业需要增强内生动力,尽量依靠自有资金和营业收入来进行经营,避免在资本市场上经受各种不同类型的风险,为企业自主研发核心技术和产品提供稳定,温和的外部环境...
如果我们在自己尚未掌握核心技术之前,企图依靠上市来筹集资金,然后使劲往某个领域砸钱,然
- oracle 数据块结构
daizj
oracle块数据块块结构行目录
oracle 数据块是数据库存储的最小单位,一般为操作系统块的N倍。其结构为:
块头--〉空行--〉数据,其实际为纵行结构。
块的标准大小由初始化参数DB_BLOCK_SIZE指定。具有标准大小的块称为标准块(Standard Block)。块的大小和标准块的大小不同的块叫非标准块(Nonstandard Block)。同一数据库中,Oracle9i及以上版本支持同一数据库中同时使用标
- github上一些觉得对自己工作有用的项目收集
dengkane
github
github上一些觉得对自己工作有用的项目收集
技能类
markdown语法中文说明
回到顶部
全文检索
elasticsearch
bigdesk elasticsearch管理插件
回到顶部
nosql
mapdb 支持亿级别map, list, 支持事务. 可考虑做为缓存使用
C
- 初二上学期难记单词二
dcj3sjt126com
englishword
dangerous 危险的
panda 熊猫
lion 狮子
elephant 象
monkey 猴子
tiger 老虎
deer 鹿
snake 蛇
rabbit 兔子
duck 鸭
horse 马
forest 森林
fall 跌倒;落下
climb 爬;攀登
finish 完成;结束
cinema 电影院;电影
seafood 海鲜;海产食品
bank 银行
- 8、mysql外键(FOREIGN KEY)的简单使用
dcj3sjt126com
mysql
一、基本概念
1、MySQL中“键”和“索引”的定义相同,所以外键和主键一样也是索引的一种。不同的是MySQL会自动为所有表的主键进行索引,但是外键字段必须由用户进行明确的索引。用于外键关系的字段必须在所有的参照表中进行明确地索引,InnoDB不能自动地创建索引。
2、外键可以是一对一的,一个表的记录只能与另一个表的一条记录连接,或者是一对多的,一个表的记录与另一个表的多条记录连接。
3、如
- java循环标签 Foreach
shuizhaosi888
标签java循环foreach
1. 简单的for循环
public static void main(String[] args) {
for (int i = 1, y = i + 10; i < 5 && y < 12; i++, y = i * 2) {
System.err.println("i=" + i + " y="
- Spring Security(05)——异常信息本地化
234390216
exceptionSpring Security异常信息本地化
异常信息本地化
Spring Security支持将展现给终端用户看的异常信息本地化,这些信息包括认证失败、访问被拒绝等。而对于展现给开发者看的异常信息和日志信息(如配置错误)则是不能够进行本地化的,它们是以英文硬编码在Spring Security的代码中的。在Spring-Security-core-x
- DUBBO架构服务端告警Failed to send message Response
javamingtingzhao
架构DUBBO
废话不多说,警告日志如下,不知道有哪位遇到过,此异常在服务端抛出(服务器启动第一次运行会有这个警告),后续运行没问题,找了好久真心不知道哪里错了。
WARN 2015-07-18 22:31:15,272 com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(84)
- JS中Date对象中几个用法
leeqq
JavaScriptDate最后一天
近来工作中遇到这样的两个需求
1. 给个Date对象,找出该时间所在月的第一天和最后一天
2. 给个Date对象,找出该时间所在周的第一天和最后一天
需求1中的找月第一天很简单,我记得api中有setDate方法可以使用
使用setDate方法前,先看看getDate
var date = new Date();
console.log(date);
// Sat J
- MFC中使用ado技术操作数据库
你不认识的休道人
sqlmfc
1.在stdafx.h中导入ado动态链接库
#import"C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","end")2.在CTestApp文件的InitInstance()函数中domodal之前写::CoIniti
- Android Studio加速
rensanning
android studio
Android Studio慢、吃内存!启动时后会立即通过Gradle来sync & build工程。
(1)设置Android Studio
a) 禁用插件
File -> Settings... Plugins 去掉一些没有用的插件。
比如:Git Integration、GitHub、Google Cloud Testing、Google Cloud
- 各数据库的批量Update操作
tomcat_oracle
javaoraclesqlmysqlsqlite
MyBatis的update元素的用法与insert元素基本相同,因此本篇不打算重复了。本篇仅记录批量update操作的
sql语句,懂得SQL语句,那么MyBatis部分的操作就简单了。 注意:下列批量更新语句都是作为一个事务整体执行,要不全部成功,要不全部回滚。
MSSQL的SQL语句
WITH R AS(
SELECT 'John' as name, 18 as
- html禁止清除input文本输入缓存
xp9802
input
多数浏览器默认会缓存input的值,只有使用ctl+F5强制刷新的才可以清除缓存记录。如果不想让浏览器缓存input的值,有2种方法:
方法一: 在不想使用缓存的input中添加 autocomplete="off"; eg: <input type="text" autocomplete="off" name