Redian新闻
>
最近Code Review看到的奇葩代码
avatar
最近Code Review看到的奇葩代码# Java - 爪哇娇娃
c*7
1
我现在博后拿J1,已经waiver,老板也很支持我申请绿卡。咨询了律师,建议我走EB1B
。但律师说要permanent job才可以,而postdoc不算是permanent,所以想问各位xdjm
,大家申请EB1B的时候是怎样拿到这种permanent job proof?我需要先换成其他的
title,比如scientist,再申请EB1B吗?
谢谢啦
avatar
a*e
2
确定是男的吗。。。。
avatar
k*y
3
怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
倒柜终于又找出了材料.
手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
和大家分享:)))
avatar
s*5
4
Want to be an oracle DBA in the future. Appreciate it if anyone can offer
some advices or a book list. Now I only know how to write simple SQL query.
Figure probably need to start from the developer side and learn how to write
PL/SQL.....Any good books?
pls, anyone know how to find some data for practice?
Thanks!
avatar
a*7
5
简直不能相信自己的眼睛。嗯,这些代码是外包公司写的。
1
String perm = something;
if (perm != null || perm != "") {
String[] permArray = perm.split(";");
...
}
2
String ruleArr[] = ruleName.split(",");
if (ruleArr != null && ruleArr.length > 0) {
for (int iCount = 0; iCount < ruleArr.length; iCount++) {
if (null != ruleArr[iCount] || ruleArr[iCount].length() > 0
|| ruleArr[iCount] != "") {
ruleNames.add(ruleArr[iCount]);
}
}
}
3
String l_alphabet;

if(null!=p_filterDTO.getAlphabet()){
l_alphabet=p_filterDTO.getAlphabet();
}else{
l_alphabet=null;
}
avatar
t*2
6
谁敢惹您?

【在 a*****e 的大作中提到】
: 确定是男的吗。。。。
avatar
s*c
7
赞~mm重新出山,果然不同凡响哇~

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
y*w
8
begin with a database developer if you still don't have a job database
related now.
try this one:
http://www.amazon.com/Oracle-PL-SQL-Programming-Versions/dp/0596514468/ref=sr_1_1?ie=UTF8&qid=1289081604&sr=8-1

.
write

【在 s******5 的大作中提到】
: Want to be an oracle DBA in the future. Appreciate it if anyone can offer
: some advices or a book list. Now I only know how to write simple SQL query.
: Figure probably need to start from the developer side and learn how to write
: PL/SQL.....Any good books?
: pls, anyone know how to find some data for practice?
: Thanks!

avatar
W*o
9
大牛,这些代码转成专业写法应该怎么写?

【在 a*********7 的大作中提到】
: 简直不能相信自己的眼睛。嗯,这些代码是外包公司写的。
: 1
: String perm = something;
: if (perm != null || perm != "") {
: String[] permArray = perm.split(";");
: ...
: }
: 2
: String ruleArr[] = ruleName.split(",");
: if (ruleArr != null && ruleArr.length > 0) {

avatar
G*5
10
呵呵,站务不管PA行为了吗?
大叔我还真不怕一个骂大街的。
话说你认为跟只鸡计较高低就是真男人了,显然逻辑不对吗。
男人他躺着也比鸡髙!
avatar
r*q
11
pretty!
avatar
B*g
12
if you only know simple sql and if you are not to bad in programming, my
advice to you is learn java.

offer
query.
write

【在 s******5 的大作中提到】
: Want to be an oracle DBA in the future. Appreciate it if anyone can offer
: some advices or a book list. Now I only know how to write simple SQL query.
: Figure probably need to start from the developer side and learn how to write
: PL/SQL.....Any good books?
: pls, anyone know how to find some data for practice?
: Thanks!

avatar
z*e
13
好几个错啊
比如string比较应该用.equals("")
!=""这个对于String s = new String("");
这种就挂了
还有||显然是&&
最后下划线定义变量名,这个是c,python程序员才这么干的
java几乎不用下划线来命名

【在 W***o 的大作中提到】
: 大牛,这些代码转成专业写法应该怎么写?
avatar
C*e
14
猫猫抱一个~
看来早孕反应结束了呀

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
s*5
15
I just finished reading the book "Oracle PL/SQL Programming". I guess I need
to do some exercise now. Can anyone suggest some exercise material for
PLSQL? Many thanks!
avatar
z*e
16
3那个比较搞笑
写了一大段等于没写
我猜想本意是
pFilterDTO != null
如果dto为null的话,这里直接抛一个nullpointerexception
avatar
k*y
17
基本上结束了, 不过还时不时反复一下:(
好想圣诞节回湾区, 可惜大宝不让:(((

【在 C*******e 的大作中提到】
: 猫猫抱一个~
: 看来早孕反应结束了呀

avatar
B*g
18
kick, I haven't finished yet.

need

【在 s******5 的大作中提到】
: I just finished reading the book "Oracle PL/SQL Programming". I guess I need
: to do some exercise now. Can anyone suggest some exercise material for
: PLSQL? Many thanks!

avatar
o*g
19
我以前私有成员变量喜欢在最开始加个下划线
后来用了spring把我这毛病给改了

【在 z****e 的大作中提到】
: 好几个错啊
: 比如string比较应该用.equals("")
: !=""这个对于String s = new String("");
: 这种就挂了
: 还有||显然是&&
: 最后下划线定义变量名,这个是c,python程序员才这么干的
: java几乎不用下划线来命名

avatar
n*n
20
太美了~~~~~~
avatar
b*r
21
As I know, DBA not need to know PL/SQL, but do need to write better SQL
query.
One part of DBA job is performance tuning. If you want o be a DBA, you can
spend some time on SQL Tuning, like understanding CBO optimizer, execution
plan, index usage, join, hint... etc.

.
write

【在 s******5 的大作中提到】
: Want to be an oracle DBA in the future. Appreciate it if anyone can offer
: some advices or a book list. Now I only know how to write simple SQL query.
: Figure probably need to start from the developer side and learn how to write
: PL/SQL.....Any good books?
: pls, anyone know how to find some data for practice?
: Thanks!

avatar
a*w
22
Java String是immutable的,用==无妨
mutable的才需要用equals

【在 z****e 的大作中提到】
: 好几个错啊
: 比如string比较应该用.equals("")
: !=""这个对于String s = new String("");
: 这种就挂了
: 还有||显然是&&
: 最后下划线定义变量名,这个是c,python程序员才这么干的
: java几乎不用下划线来命名

avatar
C*e
23
bs他!

【在 k*******y 的大作中提到】
: 基本上结束了, 不过还时不时反复一下:(
: 好想圣诞节回湾区, 可惜大宝不让:(((

avatar
y*9
24

If your goal is to become Oracle DBA, then you don't need to start from PL/
SQL, instead, you need to focus on Oracle core DBA skills. Check the online
documentation:http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/toc.htm, for various DBA tasks. For exampls: Install and configure Oracle software, patching, upgrade; backup and recovery; manage users and prvilleges, create database and monitor database; performance tunning; move data; etc. Come to learn PL/SQL whenever needed to complete a DBA task.
Check the advice from Mr Huang Young is very relevant:http://yong321.freeshell.org/oranotes/OracleStudy.txt. Reading and practice are the keys. Check those Oracle video from www.boobooke.com to see how others practise a DBA topic in their test environment.
The book I recommended is: Tom kyte's Expert Oracle Database Architecture.
you can get e-book from http://www.boobooke.com/bbs/thread-75236-1-1.html
It is a great book for DBA and developer. Need to login to download. many
other oracle e-book in that site too. Buy a paper version is better: Amazon:
http://www.amazon.com/dp/1430229462?tag=asktom03-20&camp=14573&
Trying to get a Metalink account (now called My Oracle support) is also
helpful. Check this if you don't have one from your current job : http://www.bluegecko.net/oracle/how-i-got-access-to-my-oracle-support-mos-for-us2-67/
To land on the first Oracle DBA job in US, that's another story!. Bottom
line, you have to be very creative in marketing yourself. Remember the
purpose of resume is to get you interviews, it is how you perform at
interviews that will get you the job. Be very confident about yourself. Talk
, think, act and behave like a senior Oralce DBA with 5+ year experience.
How can you get experience (Jin Yan) without any job experience(Jin Li)?
Reading and practice! Learn from other people's experience by reading,
obtaining direct experience by practising. Prepare and remember various
Oracle DBA troubshooting stories as if they had happend in your working
environment and you had solved it. In short, fake it until make it.
After you gaining some confidence about DBA tasks by reading and practice
extensively, (depending on your background, could be anywhere between 1-6
months). Create a false name like: Tom, Mark, Jessica whatever, and
fabricate a resume ( to what extent really depends) with at least 5-years
experience (Jin Li). Submit your resume to some site like Dice, and get any
chance to be interviewed to demonstrate your knowlege and skills. You could
use the false resume to get a contract job through ICC at first. ICC does
not care your experience in your resume, they care if you can be sold to
their clients. Just be creative...
BTW, improving your English skill is also important. I have interviewed more
than 10 Oracle DBAs from ICC for my company's contract position last year,
it is really hard to find good Oracle DBAs though all of them claim 5+ year
experience. I only encountered one Chinese guy with absolute real resume (he
put his phd in mechnical engineering in the resume which I think is not
relevent, but based on that I believed he told the truth), and I have not
tested his technical skills as he worked more years as DBA than me and I
believed him. I sent him to the second round though I knew his English is a
shortcoming. My team leader immediatly gave him a call in the evening. But
my Chinese friend's spoken English is too bad, my team leader has to call me
in to do a 3-way conversation to understand what he says. Another reason he
failed was he just off a job and have not spend any time to prepare for a
techinical interview. You know who cares about those baisc interview
questions if you have been performing your day to day DBA routine for many
years?
Good luck to my fellow Chinese who are interested in Oracle DBA career! Hope
my advice helps.

【在 s******5 的大作中提到】
: Want to be an oracle DBA in the future. Appreciate it if anyone can offer
: some advices or a book list. Now I only know how to write simple SQL query.
: Figure probably need to start from the developer side and learn how to write
: PL/SQL.....Any good books?
: pls, anyone know how to find some data for practice?
: Thanks!

avatar
d*i
25
This is NOT true. .equals() to test the string value. == to test if they are
the same obj.

【在 a*w 的大作中提到】
: Java String是immutable的,用==无妨
: mutable的才需要用equals

avatar
w*g
26
真美!赞!
avatar
y*t
27
这么好的回复怎么每人顶? 多谢! 受教了。
avatar
a*w
28
因为String是immutable的,同样内容的String变量在同一个VM里共用一个
Object。所以用==和equals比较的结果是相同的。

are

【在 d****i 的大作中提到】
: This is NOT true. .equals() to test the string value. == to test if they are
: the same obj.

avatar
k*y
29
怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
倒柜终于又找出了材料.
手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
和大家分享:)))
avatar
o*g
30
我以前也记得是这样
最近发现都不这么说了,系统里可能会有两个"string"

【在 a*w 的大作中提到】
: 因为String是immutable的,同样内容的String变量在同一个VM里共用一个
: Object。所以用==和equals比较的结果是相同的。
:
: are

avatar
s*c
31
赞~mm重新出山,果然不同凡响哇~

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
d*i
32
Take a look at the following test, you will know that you can't use == to
compare string value equal.
@Test
public void testString() {
String s1 = new String("Hello");
String s2 = new String("Hello");
String s3 = "Hello";
String s4 = "Hello";
assertTrue(s1.equals(s2)); //true
assertTrue(s1==s2); //false
assertTrue(s3==s4); //true
assertTrue(s1==s3); //false
}

【在 a*w 的大作中提到】
: 因为String是immutable的,同样内容的String变量在同一个VM里共用一个
: Object。所以用==和equals比较的结果是相同的。
:
: are

avatar
r*q
33
pretty!
avatar
Y*G
34
String a = new String("a")
String b = new String("a");
a == b : false
a.equals(b): true

【在 a*w 的大作中提到】
: 因为String是immutable的,同样内容的String变量在同一个VM里共用一个
: Object。所以用==和equals比较的结果是相同的。
:
: are

avatar
C*e
35
猫猫抱一个~
看来早孕反应结束了呀

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
x*m
36
大家都不动手写code啊,要不就不会说用==来比较string了。
avatar
k*y
37
基本上结束了, 不过还时不时反复一下:(
好想圣诞节回湾区, 可惜大宝不让:(((

【在 C*******e 的大作中提到】
: 猫猫抱一个~
: 看来早孕反应结束了呀

avatar
z*e
38
这个你动手试试就知道了

【在 a*w 的大作中提到】
: Java String是immutable的,用==无妨
: mutable的才需要用equals

avatar
n*n
39
太美了~~~~~~
avatar
z*e
40
s1 = "a"
s2 = new String("a")
其实s2是指向了一个heap,然后这个heap里面会存s1存的那个地址
所以当你用==比较的时候,就不会一样
这个也符合new这个关键字的本意
你试试就知道了
还有就是jvm本身有可能不一样
所以这种比较还是不要做
最常见的就是enum
这个就不要用==,虽然同jvm不会出问题
但是一旦垮jvm,就挂了

【在 a*w 的大作中提到】
: 因为String是immutable的,同样内容的String变量在同一个VM里共用一个
: Object。所以用==和equals比较的结果是相同的。
:
: are

avatar
C*e
41
bs他!

【在 k*******y 的大作中提到】
: 基本上结束了, 不过还时不时反复一下:(
: 好想圣诞节回湾区, 可惜大宝不让:(((

avatar
T*x
42
是不是你太挑剔了?看大家讨论了半天也没有特别奇葩的代码啊。一两个小错误。或者
你是指编程风格?

【在 a*********7 的大作中提到】
: 简直不能相信自己的眼睛。嗯,这些代码是外包公司写的。
: 1
: String perm = something;
: if (perm != null || perm != "") {
: String[] permArray = perm.split(";");
: ...
: }
: 2
: String ruleArr[] = ruleName.split(",");
: if (ruleArr != null && ruleArr.length > 0) {

avatar
w*g
43
真美!赞!
avatar
a*7
44
不是我挑剔吧。。。错误大家前面都讨论了,都是programing fundamentals
比如说第一个例子,if (perm != null || perm != "") ,一句简单的话两个错误,该
用&& 他用了||,该用!equals()他用!=。
第二个例子,也是简单一句话,
if (null != ruleArr[iCount] || ruleArr[iCount].length() > 0
|| ruleArr[iCount] != "")
三个错,1)该用&& 他用了|| 2) 该用!equals()他用!= 3)length() > 0 和 != ""
是同样意思,无用代码。
第三个例子是典型的脱裤子放屁。
编程风格这么高深的东西我还真没顾上。。。
关键这些都是最最基本的东西啊。现在印度马工找工作完全没要求的吗。。。

【在 T*******x 的大作中提到】
: 是不是你太挑剔了?看大家讨论了半天也没有特别奇葩的代码啊。一两个小错误。或者
: 你是指编程风格?

avatar
s*i
45
一鸣惊人
很漂亮

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
a*7
46
补充了几个例子
avatar
t*5
47
恭喜恭喜。什么时候的预产期?现在好好享受,有了孩子之后,做好准备,会有很长一
段时间没办法玩手工哦。
avatar
a*i
48

用&& 用||,我觉得你的理解不太对。这个是判断perm是不是个空的,空的意思包括
null, "", " ",和各种空白字符,他没有trim,其实还不太完整。这是个很常见的判
断。
"

【在 a*********7 的大作中提到】
: 不是我挑剔吧。。。错误大家前面都讨论了,都是programing fundamentals
: 比如说第一个例子,if (perm != null || perm != "") ,一句简单的话两个错误,该
: 用&& 他用了||,该用!equals()他用!=。
: 第二个例子,也是简单一句话,
: if (null != ruleArr[iCount] || ruleArr[iCount].length() > 0
: || ruleArr[iCount] != "")
: 三个错,1)该用&& 他用了|| 2) 该用!equals()他用!= 3)length() > 0 和 != ""
: 是同样意思,无用代码。
: 第三个例子是典型的脱裤子放屁。
: 编程风格这么高深的东西我还真没顾上。。。

avatar
p*p
49
请问首饰的原材料在哪里买? 可以给个链接吗? 俺是手工艺版的新成员~

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
s*c
50
So if perm is null, what do you expect the code will execute? if, or else?
Can you find a scenario that the else clause will ever get executed?
if (perm != null || perm != "")
else

【在 a****i 的大作中提到】
:
: 用&& 用||,我觉得你的理解不太对。这个是判断perm是不是个空的,空的意思包括
: null, "", " ",和各种空白字符,他没有trim,其实还不太完整。这是个很常见的判
: 断。
: "

avatar
o*w
51
waaa pretty!!!! I havent been touching my jewelry kit in a long long time!!!
!
avatar
a*7
52
用||的话,那个if expression永远为真(即使不等号改正为!equals()),因为没有一
个String同时是null又是""
所以如果perm = null, perm.split(";")会被执行,得到nullpointer exception.
if (perm != null || perm != "") {
String[] permArray = perm.split(";");
...
}

【在 a****i 的大作中提到】
:
: 用&& 用||,我觉得你的理解不太对。这个是判断perm是不是个空的,空的意思包括
: null, "", " ",和各种空白字符,他没有trim,其实还不太完整。这是个很常见的判
: 断。
: "

avatar
s*i
53
一鸣惊人
很漂亮

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
a*i
54
对,我这个想错了,应该是用&&的
用||完全是一个bug,unit test就通不过

【在 a*********7 的大作中提到】
: 用||的话,那个if expression永远为真(即使不等号改正为!equals()),因为没有一
: 个String同时是null又是""
: 所以如果perm = null, perm.split(";")会被执行,得到nullpointer exception.
: if (perm != null || perm != "") {
: String[] permArray = perm.split(";");
: ...
: }

avatar
t*5
55
恭喜恭喜。什么时候的预产期?现在好好享受,有了孩子之后,做好准备,会有很长一
段时间没办法玩手工哦。
avatar
S*A
56
nonono,对string来说,==是用来比较地址,而equals才是比较两个字符串是否真的一
致。

【在 a*w 的大作中提到】
: Java String是immutable的,用==无妨
: mutable的才需要用equals

avatar
p*p
57
请问首饰的原材料在哪里买? 可以给个链接吗? 俺是手工艺版的新成员~

【在 k*******y 的大作中提到】
: 怀孕了, 变懒, 好久没动手了. 再加上搬家之后, 很多东西都找不到了, 昨天终于翻箱
: 倒柜终于又找出了材料.
: 手边的珠子不多, 颜色很有限, 而且好久没做首饰了, 感觉差了好多, 上一个刚做好的
: 和大家分享:)))

avatar
g*g
58
都别争了,调用StringUtils.isBlank, isEmpty才是这种代码的标准写法。
avatar
o*w
59
waaa pretty!!!! I havent been touching my jewelry kit in a long long time!!!
!
avatar
z*s
60
如果不用commons,guava的呢? 都不是好公司?

【在 g*****g 的大作中提到】
: 都别争了,调用StringUtils.isBlank, isEmpty才是这种代码的标准写法。
avatar
t*l
61
这要多复杂的脑子多高的审美能做出来啊,光扭那个铜丝就够我想半天了……
avatar
g*g
62
这种基础轮子都不用的公司,不做也罢。我老人家虽然是码农,也码些有附加值的东西
,重复做轮子趁早走人。

【在 z***s 的大作中提到】
: 如果不用commons,guava的呢? 都不是好公司?
avatar
h*u
63
真美!赞!
avatar
z*s
64
是不是流行的基本就是这二选一了?

【在 g*****g 的大作中提到】
: 这种基础轮子都不用的公司,不做也罢。我老人家虽然是码农,也码些有附加值的东西
: ,重复做轮子趁早走人。

avatar
i*a
65


【在 s*****i 的大作中提到】
: 一鸣惊人
: 很漂亮

avatar
c*r
66
facepalm....
when compare string, below is the better way if StringUtils is not used.
String str;
if("bla".equals(str)){
}
avatar
N*n
67
真好看。紫色太美了。
怎么能拍出这么好看的照片。最后一张的效果。请教。
有哪个mm知道吗?
avatar
w*6
68
String 是完全可以用 == 判断null 和“”(长度为0的字符串)的。
if (perm != null || perm != "") 逻辑确实是错误的。
null != String 变量的写法无疑是非常恶心的。
avatar
g*g
69
二选二吧。

【在 z***s 的大作中提到】
: 是不是流行的基本就是这二选一了?
avatar
z*s
70
我的意思是这两个最流行,挑哪个都行。

【在 g*****g 的大作中提到】
: 二选二吧。
avatar
h*y
71
这种写法都是javascript那帮人用的。不这末写有时候死都不知道怎么死的。

【在 w*****6 的大作中提到】
: String 是完全可以用 == 判断null 和“”(长度为0的字符串)的。
: if (perm != null || perm != "") 逻辑确实是错误的。
: null != String 变量的写法无疑是非常恶心的。

avatar
z*e
72
各位同学们的基本功要好好强化一下
string的比较不能用==是一个基本原则
除了primitive type,其他全部都不能用==,无脑记住就好了
当然要深究下去,需要了解一下jvm是怎么实现的
string pool这些,但是了解一点是不够的,要深入一点
尤其是垮虚拟机之类的,其实还不如无脑记那条rule算了
打开ide,执行一下以下代码就明白了
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s1 = "";
String s2 = new String("");
System.out.println(s1==s2);
}
}

【在 w*****6 的大作中提到】
: String 是完全可以用 == 判断null 和“”(长度为0的字符串)的。
: if (perm != null || perm != "") 逻辑确实是错误的。
: null != String 变量的写法无疑是非常恶心的。

avatar
z*e
73
!=null可以不用调换
以前都是!"".equals(var)这种写法比较多
不过如果有!=null加&&的话,两个都不需要掉头
现在太多非java程序员转行写java,各种坏习惯都带过来

【在 h***y 的大作中提到】
: 这种写法都是javascript那帮人用的。不这末写有时候死都不知道怎么死的。
avatar
h*y
74
所有封装过的对象都不能用==。不然比的是对象地址,未有什么意义。

【在 w*****6 的大作中提到】
: String 是完全可以用 == 判断null 和“”(长度为0的字符串)的。
: if (perm != null || perm != "") 逻辑确实是错误的。
: null != String 变量的写法无疑是非常恶心的。

avatar
x*p
75
版上Java盲真多。基本概念都不懂也跑上来丢人。
avatar
l*p
76
第三个,null能做左操作数?

"

【在 a*********7 的大作中提到】
: 不是我挑剔吧。。。错误大家前面都讨论了,都是programing fundamentals
: 比如说第一个例子,if (perm != null || perm != "") ,一句简单的话两个错误,该
: 用&& 他用了||,该用!equals()他用!=。
: 第二个例子,也是简单一句话,
: if (null != ruleArr[iCount] || ruleArr[iCount].length() > 0
: || ruleArr[iCount] != "")
: 三个错,1)该用&& 他用了|| 2) 该用!equals()他用!= 3)length() > 0 和 != ""
: 是同样意思,无用代码。
: 第三个例子是典型的脱裤子放屁。
: 编程风格这么高深的东西我还真没顾上。。。

avatar
w*r
77
写第一个的肯定是写script写惯了
在前后台切换写代码,我也会老干这种事情,哈哈
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。