Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Java &brvbar, &gt, &lt symbols used in comparisions

  Asked By: Aditi    Date: Sep 09    Category: Java    Views: 826
  

I've been writing Java for over 3 years now. Since I'm unemployed I
decided to try to help myself and take the Java Programmers Cert
test. I take the test today at 1pm EST, and I feel confident I'll
pass, but I keep seeing these comparisions come up I've never seen
before. Below are a couple examples and I was just wondering if
someone could email me with a quick explaination on how to read them
properly because I can't find them in any book I have and I've never
seen anyone use them in actual code.

Ex 1:
if (i == 0 ¦ s.length() > 0)
I now know that ¦ == |, but why not use |. More complex
examples are below.

Ex 2:
byte b1 = -12;
byte b2 = -4;
byte b3 = (byte)((b1 + b2) >> c);
//b3 == -2, how??
Why are there two? What does that mean? All I know is that it's
some kind of bit change in this case but I don't understand how. Why
does it differ from the first?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Chad Bradley     Answered On: Sep 09

I took it not too long again and there wasn't anything like that on the
exam. So I guess I wouldn't worry about it. To be honest I've never
seen questions like that before. What are the & variables?

 
Answer #2    Answered By: Laurel Collins     Answered On: Sep 09

I have a feeling that the code  you're looking at was copied from an HTML page
and pasted somewhere else. The codes you are seeing are HTML codes for the
operators in the code. > translates to > in an HTML page. >> = >> <
= < etc. I doubt that something like boolean b = 5 > 3; would even compile
but I reserve the right to be wrong.

 
Answer #3    Answered By: Orville Rodriguez     Answered On: Sep 09

OK, I figured it out and the second responce is completely
correct, ">" == ">". I bought a Cert Book, "Complete Java
Certification" by Sybex and the review exams on the CD have some
questions like the examples  below. Maybe you are right and the CD is
improperly importing the html text string into the Java Applet of the
test simulator, but it was confusing the hell out of me until about 5
minutes after I posted this. Then I figured out they were one for
one substitutions.

Thank you all for your responces and I'm sorry to have wasted your
time with this.

 
Didn't find what you were looking for? Find more on Java &brvbar, &gt, &lt symbols used in comparisions Or get search suggestion and latest updates.




Tagged: