• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

bitwise operators

 
Ranch Hand
Posts: 205
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran into a problem on the enthuware test which used << which I believe is a bitwise operator. I didn't think those were on the exam anymore. Just wanted to make sure I didn't need to study them. Thanks!
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kendall Ponder wrote:I ran into a problem on the enthuware test which used << which I believe is a bitwise operator.


It's actually a bit shift operator and it's the signed left shift operator to be more precise. No need to study them! I even wonder if they are covered on the OCP exam.

&& and || are known as the conditional operators; &, | and ^ are known as the bitwise operators. The conditional operators (which are short-circuit) can only be used with booleans, so you'll see them only in conditions. The bitwise operators are used for bit operations mostly on integral types (byte, short,...) and as their name suggests they do their magic on the actual bits of the value. You could use &, | and ^ on 2 booleans as well. Bitwise operators are less commonly used and their bit-twiddling capabilities are not on the exam. For the exam you only need to know:
  • bitwise operators exist
  • how they work on booleans
  • the difference in behavior with the short-circuit operators
  • There's a huge difference between these 2 statements:

    Nothing better than a little code snippet to demonstratehow they work on booleans:Output:


    Hope it helps!
    Kind regards,
    Roel
     
    Kendall Ponder
    Ranch Hand
    Posts: 205
    4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks!
     
    author & internet detective
    Posts: 41860
    908
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Roel De Nijs wrote:It's actually a bit shift operator and it's the signed left shift operator to be more precise. No need to study them! I even wonder if they are covered on the OCP exam.


    They aren't. Bit shit operators were removed from the SCJP before the split to OCA/OCP. And they happily stayed removed!
     
    Roel De Nijs
    Sheriff
    Posts: 11604
    178
    Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Jeanne Boyarsky wrote:

    Roel De Nijs wrote:It's actually a bit shift operator and it's the signed left shift operator to be more precise. No need to study them! I even wonder if they are covered on the OCP exam.


    They aren't.


     
    Enthuware Software Support
    Posts: 4810
    52
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Kendall Ponder wrote:I ran into a problem on the enthuware test which used << which I believe is a bitwise operator. I didn't think those were on the exam anymore. Just wanted to make sure I didn't need to study them. Thanks!


    I checked the question bank for it and found only two questions that contained references to it ( 2.1240 and 2.1317). Both the questions are actually about making sure you know valid operators in Java. You don't need to know how they work to answer the question.
    In addition, 2.1240 also tests you on how compound assignments work in general (from casting perspective).

    Please let me know if you saw any other question about it.

    HTH,
    Paul.
     
    Kendall Ponder
    Ranch Hand
    Posts: 205
    4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Paul Anilprem wrote:

    Kendall Ponder wrote:I ran into a problem on the enthuware test which used << which I believe is a bitwise operator. I didn't think those were on the exam anymore. Just wanted to make sure I didn't need to study them. Thanks!


    I checked the question bank for it and found only two questions that contained references to it ( 2.1240 and 2.1317). Both the questions are actually about making sure you know valid operators in Java. You don't need to know how they work to answer the question.
    In addition, 2.1240 also tests you on how compound assignments work in general (from casting perspective).

    Please let me know if you saw any other question about it.

    HTH,
    Paul.



    2.1240 is the problem I was referring to. You have to pick out the valid constructs which is hard to do if you have ignored the bit shift operators. I take it I should know how they are used for the test?
     
    Roel De Nijs
    Sheriff
    Posts: 11604
    178
    Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Kendall Ponder wrote:I take it I should know how they are used for the test?


    No! Bit shifting is not even on the OCP exam (as Jeanne mentioned in her previous post).
     
    Kendall Ponder
    Ranch Hand
    Posts: 205
    4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks!
     
    reply
      Bookmark Topic Watch Topic
    • New Topic