Statements and operators, JAVA Programming

Assignment Help:

Operator

Functionality

Example/Explanation

=

Sets one value equal to another

counter=0  Sets the counter to equivalent the number 0

+=

Shortcut for adding to the current value.

clicks += 2  Sets the variable named counter to equivalent the current value plus two.

-=

Shortcut for subtracting from the current value.

clicks -= 2  Sets the variable named counter to equivalent the current value minus two.

*=

Shortcut for multiplying the current value.

clicks *= 2  Sets the variable named counter to equivalent the current value multiplied by two.

/=

Shortcut for dividing the current value.

clicks /= 2  Sets the variable named counter to equivalent the current value divided by two.

Description: The comparison operators used to compare two items & return a value of "true"if the condition evaluates to true, else they return false.

Functionality

Example/Explanation

==

Returns a true value if the items are the similar

Counter == 10  Returns the value "true" if the counter's value is equal to the number 10 currently

!=

Returns a true value if the items are not the similar

Counter != 10  Returns the value "true" if the counter's value is any value apart from the number 10

Returns a true value if the item of left is greater than the item of right

counter>10  Returns the value "true" if the counter's value is larger than the number 10

>=

Returns a true value if the item of left is equal to or greater than the item of right

counter>=10  Returns the value "true" if the counter's value is equivalent to or larger than the number 10

Returns a true value if the item of left is less than the item on the right

counter<10  Returns the value "true" if the counter's value is smaller than the number 10

<=

Returns a true value if the item of left is equal to or less than the item of right

counter<=10  Returns the value "true" if the counter's value is equivalent to or less than the number 10

Computational Operators

Description: The computational operators carry out a mathematical function on a value or values, and return a single value.

       operation

 Functionality

Example/Explanation

+

Adds two values together

counter+2  Returns the sum of the counter plus 2

-

Subtracts one value from another

counter-2  Returns the sum of the counter minus

2

*

Multiplies two values

counter*10  Returns the result of variable times 10

/

Divides the value of left by the one on the right and the result returns

counter/2  Divides the current value of the counter through 2 and returns the result

++X

Increments the value, & then returns the result

++counter  Looks at the current value of the counter, increments it through one, and then returns the result. If the counter contains a value of 3, this expression returns the value of 4.

X++

Returns the value, & then increments the value

counter++ Returns the value of the counter, then  do increments in the counter. If the counter contains a value of 3, this expression returns the value of 3, and then sets the counter value to 4.

--X

Decreases the value, & then returns the result

--counter Looks at the current value of the counter, decreases it through one, and then returns the result. If the counter contain a value of 7, this expression returns the value of 6.

X--

Returns the value, and then decreases the value

counter--  Returns the value of the counter, then decreases the counter value. If the counter contains a value of seven, this expression returns the value of seven, then sets the counter value to six


Related Discussions:- Statements and operators

Agile software development processes, Agile software development process is...

Agile software development process is receiving popularity  and  momentum  across organizations. Highest priority is to satisfy the end user. Welcome requirement modifie

What is mvc, Model-View-Controller (MVC) is a design pattern put together t...

Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. ? Model: The model having the core of

Java application to simulate a bank system, Write a Java application to sim...

Write a Java application to simulate a bank system. In the system, customers can open new bank accounts with the bank, and register/use an online account to manage their bank accou

Relate java with JVM, Relate java with JVM Java performance gets better...

Relate java with JVM Java performance gets better each year as JVM gets smarter. This works, since making JVM smarter doesn't require any great change to the java language, sou

What is bandwidth, What is bandwidth? In a general way Bandwidth is a c...

What is bandwidth? In a general way Bandwidth is a capacity of communication channel of carrying data.

Functions in javascript, These are the central working units of JavaScript....

These are the central working units of JavaScript. Almost all the scripting code employs one or more functions to obtain the desired result. If you desire your page to provide cert

Control graphical user interface elements, Introduction In this assign...

Introduction In this assignment you will use Processing to create some geometric objects and graphical user interface (GUI) elements that Processing itself lacks. Processing h

Design and implement online food delivery system, You are required to  desi...

You are required to  design & implement  online  food delivery  system  using Java RMI technology.  This involves writing both the server and the client program(s). Client programs

Java web programming, Write a JSP to display a table that contains factoria...

Write a JSP to display a table that contains factorials for the numbers from 0 to 10,

Want a page to store emails when click as save, Want a page to store emails...

Want a page to store emails when click as save, then pass along to another page with the emails in the URL Project Description: I have a page that populates with listing; the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd