<< 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

True.

Back to Question 34

Answer 33

The assignment operator is a binary operator.

Back to Question 33

Answer 32

True.

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 biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




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?

Ask