if(“test1”.equals(strComparer))然后 [英] if ("test1".equals(strComparer) ) then

查看:91
本文介绍了if(“test1”.equals(strComparer))然后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的主题是基本的问题。显然这不行。

技术原因是什么?


是因为这里,test1现在有点像静态对象吗?


究竟是什么" test1"在这种情况下?


谢谢。

解决方案

好的这篇文章不清楚...阅读下面


D E <无***** @ nothing.com>在消息中写道

news:02 ******************* @ nwrdny01.gnilink.net ...

好的主题是基本的问题。显然这是
......

" this"是这行代码:


//开始代码段

String strComparer =" test2";

if(" ; test1" .equals(strComparer))然后

System.out.println(" strComparer应输出\" test1 \"");

//结束代码段


不会工作。技术原因是什么?

是不是因为这里,test1现在有点像静态对象吗?

究竟是什么test1在这种情况下?

谢谢。



" D E" <无***** @ nothing.com>在留言中写道

新闻:F6 ******************* @ nwrdny01.gnilink.net ...

好的,这篇文章不清楚......请阅读下面

D E <无***** @ nothing.com>在消息中写道
新闻:02 ******************* @ nwrdny01.gnilink.net ...

确定主题行基本上是个问题。显然这个


.....
这个是这行代码:

//开始代码段
字符串strComparer =" test2";
if(" test1" .equals(strComparer))then br /> System.out.println(" strComparer应该输出\test1 \"");
//结束代码段

不会工作。< blockquote class =post_quotes>技术原因是什么?

是不是因为这里,test1现在有点像静态对象吗?

究竟是什么test1在这种情况下?

谢谢。



技术原因 test1和test2不相等是因为

他们是由不同的角色组成的。两者都是test1。和test2是
java.lang.String的实例。它们被称为字符串文字。


Ryan Stewart< zz ******** @ gspamo.com>潦草地写下:

D E <无***** @ nothing.com>在消息中写道
新闻:F6 ******************* @ nwrdny01.gnilink.net ...

好的这篇文章是不清楚...阅读下面

D E <无***** @ nothing.com>在消息中写道
新闻:02 ******************* @ nwrdny01.gnilink.net ...

>好的主题是基本的问题。显然这个


.....
这个是这行代码:

//开始代码段
字符串strComparer =" test2";
if(" test1" .equals(strComparer))then br /> System.out.println(" strComparer应该输出\test1 \"");
//结束代码段

不会工作。< blockquote class =post_quotes>>技术原因是什么?
>
>是因为在这里,test1是现在有点像静态物体吗?
>
>究竟是什么test1在这种情况下?
>
>谢谢。
>


技术原因 test1和test2不相等是因为他们是由不同的人物组成的。两者都是test1。和test2是java.lang.String的实例。他们被称为字符串文字。




它如何工作或不工作或什么时候甚至不能编译?单词

" then"导致语法错误。


-

/ - Joona Palaste(pa*****@cc.helsinki.fi)---- ---------芬兰-------- \

\-- http://www.helsinki.fi/~palaste ---------------------规则! -------- /

" B-but Angus!你是龙!

- 米老鼠


Ok the subject line is basically the question. Obviously this won''t work.
What is the technical reason?

Is it because here, "test1" is sort of like a static object now?

What exactly is "test1" in this case?

Thanks.

解决方案

Ok this post was unclear... read below

"D E" <no*****@nothing.com> wrote in message
news:02*******************@nwrdny01.gnilink.net...

Ok the subject line is basically the question. Obviously this ......
"this" being this line of code:

//begin code segment
String strComparer = "test2";
if ("test1".equals(strComparer) ) then
System.out.println("strComparer should output \"test1\"");
//end code segment

won''t work. What is the technical reason?

Is it because here, "test1" is sort of like a static object now?

What exactly is "test1" in this case?

Thanks.



"D E" <no*****@nothing.com> wrote in message
news:F6*******************@nwrdny01.gnilink.net...

Ok this post was unclear... read below

"D E" <no*****@nothing.com> wrote in message
news:02*******************@nwrdny01.gnilink.net...

Ok the subject line is basically the question. Obviously this


.....
"this" being this line of code:

//begin code segment
String strComparer = "test2";
if ("test1".equals(strComparer) ) then
System.out.println("strComparer should output \"test1\"");
//end code segment

won''t work.

What is the technical reason?

Is it because here, "test1" is sort of like a static object now?

What exactly is "test1" in this case?

Thanks.


The "technical reason" that "test1" and "test2" are not equal is because
they''re composed of different characters. Both "test1" and "test2" are
instances of java.lang.String. They''re called string literals.


Ryan Stewart <zz********@gspamo.com> scribbled the following:

"D E" <no*****@nothing.com> wrote in message
news:F6*******************@nwrdny01.gnilink.net...

Ok this post was unclear... read below

"D E" <no*****@nothing.com> wrote in message
news:02*******************@nwrdny01.gnilink.net...

> Ok the subject line is basically the question. Obviously this


.....
"this" being this line of code:

//begin code segment
String strComparer = "test2";
if ("test1".equals(strComparer) ) then
System.out.println("strComparer should output \"test1\"");
//end code segment

won''t work.

> What is the technical reason?
>
> Is it because here, "test1" is sort of like a static object now?
>
> What exactly is "test1" in this case?
>
> Thanks.
>


The "technical reason" that "test1" and "test2" are not equal is because
they''re composed of different characters. Both "test1" and "test2" are
instances of java.lang.String. They''re called string literals.



How can it "work" or "not work" when it won''t even compile? The word
"then" causes a syntax error.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"B-but Angus! You''re a dragon!"
- Mickey Mouse


这篇关于if(“test1”.equals(strComparer))然后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆