<< Chapter < Page Chapter >> Page >

Back to Question 37

Answer 36

Listing 5 . Listing for Answer 36.
/*File SampProg07.java from module 22 Copyright 1997, R.G.BaldwinWithout reviewing the following solution, write a Java application that clearly illustrates the difference betweenthe prefix and the postfix versions of the increment operator.Provide a termination message that displays your name. *********************************************************/class SampProg07{ static public void main(String[]args){ int x = 3;int y = 3; int z = 10;System.out.println("Prefix version gives " + (z + ++x));System.out.println("Postfix version gives " + (z + y++));System.out.println("Terminating, Dick Baldwin"); }//end main}//end class SampProg07

Back to Question 36

Answer 35

Java supports the following list of shortcut assignment operators. These operators allow you to perform an assignment and another operation with asingle operator.

+= -=*= /=%=&= |=^=<<=>>=>>>=

For example, the two statements that follow perform the same operation.

  • x += y;
  • x = x + y;

The behavior of each of the shortcut assignment operators follows this same pattern.

Back to Question 35

Answer 34


Back to Question 34

Answer 33

The assignment operator is a binary operator.

Back to Question 33

Answer 32


Back to Question 32

Answer 31

The answer for the bitwise exclusive or is:

  • 11 1 xor 1 produces 0
  • 10 1 xor 0 produces 1
  • 01 0 xor 1 produces 1
  • 00 0 xor 0 produces 0

Back to Question 31

Answer 30

The answer for the bitwise inclusive or is:

  • 11 1 or 1 produces 1
  • 10 1 or 0 produces 1
  • 01 0 or 1 produces 1
  • 00 0 or 0 produces 0

Back to Question 30

Answer 29

The answer for the bitwise and is:

  • 11 1 and 1 produces 1
  • 10 1 and 0 produces 0
  • 01 0 and 1 produces 0
  • 00 0 and 0 produces 0

Back to Question 29

Answer 28

True: Bits shifted off the right end are lost.

Back to Question 28

Answer 27

False: In Java, the signed right shift operation populates the vacated bits with the sign bit, while the left shift and the unsigned right shift populate the vacated bits with zeros.

Back to Question 27

Answer 26

The following table shows the seven bitwise operators supported by Java.

Bitwise operators Operator Typical Use Operation>>OpLeft>>Dist Shift bits of OpLeft right by Dist bits (signed)<<OpLeft<<Dist Shift bits of OpLeft left by Dist bits>>>OpLeft>>>Dist Shift bits of OpLeft right by Dist bits (unsigned)&OpLeft&OpRight Bitwise and of the two operands| OpLeft | OpRight Bitwise

Back to Question 26

Answer 25

The bitwise and operator and the bitwise inclusive or operator are shown below.

Two bitwise operators &bitwise and | bitwise inclusive or

Back to Question 25

Answer 24

An important characteristic of the behavior of the logical and operator and the logical or operator in Java is that the expressions containing them are evaluated from left to right. The evaluation of the expression is. terminated as soon as the result of evaluatingthe expression can be determined. For example, in the expression given in Question 24 , if the variable a is less than the variable b , there is no need to evaluate the right operand of the || operator to determine the value of the entire expression. Therefore, evaluation will terminate as soon as it isdetermined that a is less than b .

Questions & Answers

what is variations in raman spectra for nanomaterials
Jyoti Reply
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?