# [Java Problem] Demonstration of Java Expressions

Posted on the 22 April 2012 by In7rud3r
<a href="http://www.yesadvertising.com">affiliate marketing</a>

Problem Specification: Demonstration of Java expressions.

Description of the problem:  Here we used various kind of operator.

class ExpressWrap{public static void main(String args[]){//Declaration and Initialization int a=10, b=5, c=8, d=2;//Order of Evaluationint answer1 = a * b + c / d;int answer2 = a * (b + c) / d;//Type Conversionsfloat answer3 = a / c;float answer4 = (float)a / c;float answer5 = a / y;//Modulo Operationsint answer6 = a % c;float answer7 = x % y;//Logical Operationsboolean bool1 = a > b & c > d;boolean bool2 = a < b & c > d;boolean bool3 = a < b || c > d;boolean bool4 = !(a-b == c);System.out.println(“Order of Evaluation”);System.out.println(” a * b + c / d = ” + answer1);System.out.println(” a * (b + c) / d = ” + answer2);System.out.println(“Type Conversion”);System.out.println(” a / c = ” + answer3);System.out.println(” (float)a / c = ” + answer4);System.out.println(” a / y = ” + answer5);System.out.println(“Modulo Operation”);System.out.println(” a % c = ” + answer6);System.out.println(” x % y = ” + answer7);System.out.println(“Logical Operations”);System.out.println(” a > b & c > d = ” + bool1);System.out.println(” a < b & c > d = ” + bool2);System.out.println(” a < b || c > d = ” + bool3);System.out.println(” !(a-b == c) = ” + bool4);}}

<a href="http://www.yesadvertising.com">affiliate marketing</a>

### About the author

In7rud3r 97 shares View profile
View Blog

See more