自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(419)
  • 收藏
  • 关注

NullPointerException in ternary operator

java代码:Integer i = null;Integer x = true ? i : 1; assembly code:public static void main(java.lang.String[]); Code: Stack=1, Locals=3, Args_size=1 0: aconst_null 1: ...

2013-01-19 00:01:25 163

关于方法访问控制符protected

http://bbs.csdn.net/topics/390297526?page=1#post-393055530 所以总结下来,关于方法能否调用有两点:1. 方法是否属于该对象,自身的方法和继承的方法都属于对象,这是能否调用的前提,解决了有没有的问题。2. 该方法的访问控制符(access modifier)与当前调用地点是否满足访问控制符的要求,解决了见没见的问题。比如楼主提到的情形...

2012-11-29 10:38:29 212

RuntimeException为啥不用声明抛出?

异常,错误都是同一种父类:java.lang.ThrowableIllegalStateException属于RuntimeException,RuntimeException又是Exception的子类RuntimeException的特点是非受检异常,区别于受检异常,也就是java系统允许可以不catch(当然也可以人为catch,比如特殊业务逻辑需要),在运行时碰到就抛出关键RuntimeE...

2012-11-13 15:04:10 1184

java语言中classes分类

local class的scope是local,所以在方法外不可见,这个三楼说过了。这里有总结:A class defined within another class is called a nested class. Like other members of a class, a nested class can be declared static or not. A ...

2012-10-22 13:09:53 184

effective java 2nd Item 18

Prefer interfaces to abstract classes其中一段:Interfaces allow the construction of nonhierarchical type frameworks.Type hierarchies are great for organizing some things, but other things don’t fa...

2012-08-15 15:45:00 106

URL definition

http://reg.163.com/login.jsp?type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1通用格式:protocol :// host / location 1. http://reg.163.com/http   通信协议名称://    分隔符,一个...

2012-08-14 08:29:18 576

how to defend against serialization and reflection attack for eager singleton

//为什么要定义构造方法因为不定义它也会有默认构造方法,而且是public的,不符合单例的设计模式要求这种eager singleton是线程安全的,因为JVM保证了静态变量只由classloader初始化一次,也因此意味着所有调用getInstance的线程只能得到同一个变量实例但是这种方法不足以保护其免遭reflection attack,因为反射可以改变私有变量的访问控制符A...

2012-08-08 09:18:25 179

原创 Would

WouldWould is an auxiliary verb, a modal auxiliary verb. We use would mainly to:talk about the past talk about the future in the past express the conditional moodWe also use would fo...

2012-07-06 12:10:38 157

why null is allocated on java stack

提问:恩。。。俺的意思是,String str = null;str = "String";最后的"String"对象是建立在栈里的,而不是堆里的,这样一来,第一句话,仍然还是在堆中开辟空间么?因为最后的对象其实是在栈中,如果一开始声明null的时候,在堆中开辟空间,岂不是有点奇怪? 回答:1. null不是一个对象,JLS 3.10.7 中提及的是The Null L...

2012-06-05 11:45:39 97

Finalizer Guardian Idiom

Effective Java 2nd 中Item 7: Avoid finalizers關於Finalizer Guardian Idiom的論述:     If a subclass implementor overrides a superclass finalizer but forgets to invokeit, the superclass finalizer will n...

2012-05-30 11:55:10 151

Cannot open connection

异常:Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) at org.hiberna...

2012-05-24 11:34:29 414

我對多態的理解

多态(polymorphism)是以一种看待事物更细致的角度来描述事物(或者说以抓住了这种特质的独具慧眼的角度),事物多具有本质(共性),也有各种不同的变化形态(比如碳元素会有金刚石和石墨两种形态),各形态都有其独特作用,但是万变不离其宗,它们以共性相联,是基于这种独特而深刻的认识。当要利用这种物体的各个形态时,有形态变化的物体,使用起来更灵活。比如你事先预估到自己要用到人形机器人来让他干精细...

2012-05-24 09:03:42 82

关于Java 泛型 ?extends T 的问题

http://topic.csdn.net/u/20120516/22/a19617f5-943e-494c-9595-1c049b1cc3ef.html?seed=208934876&r=78626688#r_78626688问:在学习java泛型时 ,看到了泛型的一个例子List<Apple> apples = new ArrayList<Apple&gt...

2012-05-21 11:05:16 103

一个基本问题关于引用的

问:int a = 1;Integer b = new Integer(1);System.out.println(a==b);结果为什么是true但是String c = "abc";String d = new String("abc");System.out.println(c == d);结果就是false了?请说一下具体的原因  答:...

2012-05-15 10:20:34 92

Invalid byte x of n-byte UTF-8 sequence.

是在从客户端发来的SOAPMessage中getEnvelope时出了错提示错误原因是:Invalid byte 1 of 1-byte UTF-8 sequence.它解析到了在 1字节UTF-8序列中无效的第一字节1字节UTF-8序列是怎么样的呢?One-byte codes are used only for the ASCII values 0 through 127....

2012-05-14 11:50:01 148

我對面向對象和過程的理解。

我的一些理解。面向过程,是对客观现象的描述,感觉是有一个上帝视角。RedLightOn();PeopleWalk();CarStop();GreenLightOn();CarMove();面向对象,顾名思义,更加强调了客观实体与其属性和动作的关联性,突出了以各个客观实体为中心的世界观,可能更便于人类大脑理解与记忆。redlight.turnOn();pe...

2012-05-02 08:30:04 73

Knapsack problem

The Knapsack ProblemLet's apply what we're learned so far to a slightly more interesting problem. You are an art thief who has found a way to break into the impressionist wing at the Art Inst...

2012-04-28 15:07:30 159

opcode study

iconst_nIntegers n = 0..5.the n indicates the const itself, not the index, and the const would be put into the stack.istore_nstore integer in local variable n : n = 0..3it...

2012-04-24 12:55:39 90

2>&1&

a UNIX process has three standard file descriptors 0 == stdin1 == stdout2 == stderrthe 2>&1 means attach fd 2 to write to the same as stream as fd 1, essentially calling dup2()the 2nd...

2012-04-16 08:28:31 156

Big Collection

1. in regular item, soft code the zip code and store for dist level case2. There’s nothing that says that complexity has to be a requirement for developing webapplications.3. CSS selectors repre...

2012-03-27 14:54:26 272

Head First HTML with CSS and XHTML

i finished it by fast reading as well as some sort of review of knowledge of this area, time could accumulate the essence and refine it through deep thinking.

2012-03-27 14:50:09 82

session用以維護登錄登出狀態與防止重複登錄

如果一定要获得登录退出状态,就需要除了登录退出来确认在线下线外,还得有一个 在线确认+超时认定下线 机制如果没有在线确认(比如心跳消息等),就无法确认是否没有主动退出,结合了超时认定下线就可以完善退出机制。具体的可以查一下:2、session何时被删除  综合前面的讨论,session在下列情况下被删除a.程序调用HttpSession.invalidate();或b.距离上一次收...

2012-03-26 09:08:02 95

Spurious Wakup

http://www.devguli.com/blog/eng/spurious-wakeup/ en.wikipedia.org/wiki/Spurious_wakeup 虛假喚醒可能就是多核硬件環境下,JLS third爲了保證性能而作出的讓步。

2012-03-23 11:22:52 84

head first jquery

Thursday, March 22, 2012 fiinished reading head first jquery i feel i've got another much from this reading, just a memo.

2012-03-22 10:21:47 88

為何setTimeout的ajax可以實現有序自調用

$(document).ready(function(){ var FREQ = 10000 ; var repeat = true; function showFrequency(){ $("#freq").html( "Page refreshes every " + FREQ/1000 + " second(s)."); } function sta...

2012-03-21 08:35:16 96

stack and heap

我觉得是根据应用方式和本身特性才将内存分区的,目的是提高效率和方便管理等栈的特点是容量小,速度快,可能昂贵,就适合放置静态,全局等小且需要经常访问但不怎么变化的数据堆的特点是容量大,速度慢,可能便宜,就适合放置动态分配的数据,因为动态分配的数据不确定且容量大,数量多,比如对象,生存期相对较短,就以无序状态存储于堆中。像方法区之类是堆的一部分,我觉得更多是因为业务逻辑上便...

2012-01-13 23:17:50 50

that seems like enough

1. That seems like enough. 2. We often get the middle of an algorithm right but misjudge the boundaries. 3. They lose their trust in the original author and must fall back on reading the detai...

2011-08-23 16:58:52 133

How Selenium RC Works

How Selenium RC WorksFirst, we will describe how the components of Selenium RC operate and the role each plays in runningyour test scripts.RC ComponentsSelenium RC components are:The Seleni...

2011-07-25 15:58:50 83

for something to do

For the server to run you’ll need Java installedand the PATH environment variable correctly configured to run it from the console.You can check that you have Java correctly installed by running ...

2011-07-25 15:22:55 119

out there

i know out there out here for quite a long time, but never accquires its definite meaning. today i came upon it again, so i made a search.http://answers.yahoo.com/question/index?qid=201102130631...

2011-07-25 15:00:27 130

漢文與英文

1. 在造字角度,漢字以偏旁部首為最小單位,構建在二維,英語最小單位為字母,一維排列構成語義,類似于二維碼和條形碼,信息量不可同日而語,有跨階差別2. 漢字重用度高,無論遣詞造句包括漢字活用都體現了這一點,而英語單詞只能重用詞根,整個單詞重用則不太合適,會造成單詞太長 日後整理~...

2011-07-18 10:19:33 82

自此精修

四十歲后,不滯於物,草木竹石均可為劍。自此精修,漸進于無劍勝有劍之境。 每品此文,倍感漢文之精妙,字體之優美,藝術的沉澱與昇華。

2011-07-13 11:42:24 136

program experience conclusion

1. check parameters for validity To summarize, each time you write a method or constructor, you should thinkabout what restrictions exist on its parameters. You should document these restricti...

2011-07-11 15:35:18 72

java命令為何不可接受路徑連文件

提問:一个问题,javac C:\Users\Bear\Desktop\test.java能生成test.class ,但运行时却要cd C:\Users\Bear\Desktop进入目录,java test才能运行,而直接java C:\Users\Bear\Desktop\test却不行,很是纠结! 回答:我感覺是這樣 是兩個命令語法格式要求不同j...

2011-07-08 21:53:11 60

ESL Podcast 700 – Starting a New Workweek

start from my understanding of the conversation, try to write down something of my own. you are very eager for something to happen? Naomi: Wow, you look like you had a rough weekend. A l...

2011-07-05 15:04:07 116

c++與java關於重載的定義

那c++也不是很瞭解,是不是可以這樣猜測一下,通過樓主給出的例子,c++對覆蓋達成的條件與java不同,只要方法同名就構成覆蓋,因此繼承的子類中不可能出現能與父類構成重載的方法(有也直接被覆蓋或稱為隱藏),這也可能就是兩者對重載發生範圍即同域定義的些許差別. 覆蓋用來實現多態,這兩者倒是一致的而隱藏僅僅只是隱藏,隱藏者和被隱藏者兩者並不一定是一致的,因此在多態的實現上無法唯一定位(隱藏...

2011-07-05 11:12:22 64

再選能提高概率嗎

三扇门中,其中一扇后面有一辆车;其余两扇后面则是山羊。参赛者在三扇门中挑选一扇。他并不知道内里有什么。主持人知道每扇门后面有什么。主持人必须开启剩下的其中一扇门,并且必须提供换门的机会。主持人永远都会挑一扇有山羊的门。如果参赛者挑了一扇有山羊的门,主持人必须挑另一扇有山羊的门。如果参赛者挑了一扇有汽车的门,主持人随机在另外两扇门中挑一扇有山羊的门。参赛者会被问是否保持他...

2011-07-01 11:19:57 76

人工智能之學習的本質

目前的程序與人類之間的根本區別之一是人是可以自我學習提升的,學習提升可不可以理解為邏輯的自增?那人類邏輯的自增是自我完成的還是非自我完成的?信息歸根結底還是外界注入的(唯物主義),但是信息的分析、歸納、篩選是由自己完成的,計算機能做到嗎?人腦是具有抽象能力的,能將外部紛繁蕪雜、林林總總的信息歸納抽象為秩序、穩定、規律的信息,這種能力的本質又是什麽呢?讓計算機採集一堆數據,然後從中抽取出有用的,甚至...

2011-06-29 13:58:03 89

嚴謹之於科學

所謂跑得快不如跑得遠,磨刀不誤砍柴工之類,嚴謹對於科學的重要性,開始慢點沒關係,但重點要打好基礎,便可後勁十足,厚積薄發,這想必也是為啥西方教育貌似其小學、中學不如中國,卻在後期大力趕超的奇怪現象。 日本,德國人的嚴謹就保證他們能達到更高高度,更深深度,其製造業的水平和地位就是有力證明。比如搭積木,基礎搭得七歪八斜,可能在低層是沒有倒,確實比人家認認真真搭得快,但是就不會比人家搭得更高。...

2011-06-27 15:32:47 77

邏輯所謂

邏輯所謂 1.概念的建立 2.辨析即對所謂概念下邏輯的懷疑與考證 3.推理由此及彼,由表及裡

2011-06-27 11:55:09 66

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除