Home Java Java-tips Data Expressions Java: Boolean Expression Answers

Ask Questions?

View Latest Questions

Advertisement


 
 

Java: Boolean Expression Answers
Posted on: April 17, 2011 at 12:00 AM
This page discusses - Java: Boolean Expression Answers

Java Notes

Boolean Expression Answers

Name ______________________

Assume the following:

int i, j, k;
boolean b;
k = 10;
j = 6;
b = true;
Give the values of the following expressions, or illegal.
1trueb
2false!b
3true!!!!!!b
4trueb || !b
5falseb && !b
6falseb ^ true
7illegalb++
8illegalb = 1
9falseb = 1 > 2
10truetrue || 1234/26%3==1
11truetrue | 1234/26%3==1
12false!b & (j < 100)
13illegalk > j > 3
14illegalk > j && > 3
15truek > j && k > 3
16illegalb ||= false
17trueb |= false
1810k = (k>j)?k:j+1
19false(b && !b) | (!b & b)
20illegal1 > 2 > 3
21trueb = j > 0 && (i = k/j)!=0
Copyleft 2003 Fred Swartz MIT License, Last update: 2000-04-10
Advertisement


DMCA.com