Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

ilkay Polat

+ Follow
since Jan 31, 2020
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ilkay Polat

Yes you are right, Jeanne.

Same applies for post-unary and pre-unary operators. These operators are not at the same level of precedence according to table 2.1 in the book. Is this right?

Here is my example:

int x = 4 + 3 * 5;

It prints out 19 instead of 35.

By choosing which operation to perform first, we are actually choosing between two different expressions:
1. (4 + 3) * 5 == 35
2. 4 + (3 * 5) == 19

In this case * has more priority than + in Java so second option is valid. So not always from left to right.
Here I attached the table first two lines regarding order of operator precedence.

Post-unary operators and pre-unary operators are in different lines.
First post-unary operators is coming and then you see pre-unary operators on the second line.
In Chapter 2, There is table which shows order of operator precedence in Java.

According to that table, post-unary operators(expression++ or expression--) have high priority than pre-unary operators(++expression or --expression).

So if we follow this order of operator precedence, post-unary operators should be evaluated first within a given expression.

Besides Java guarantees left-to-right evaluation if and only if the operators have the same level of precedence.

So this is my reasoning for this issue.
Hi everyone,

I have a question regarding increment and decrement operators section of Chapter 2 in Sybex OCA Java SE 8 Programmer I book.

There is a practice regarding increment and decrement operators:
int x= 3;
int y = ++x * 5 / x-- + --x;
System.out.println("x is " + x);
System.out.println("y is " + y);

The book starts to evaluate "++x" at the beginning.

But according to order of operation in Java, it should evaluate x-- firstly. Right?
Yes I have tried all of them. I think those 3 options are the answers.

B) package;
D) package named.A;
F) package A;
Yes this question is from the Boyarsky and Selikoff book.

Question: Suppose we have the following class in the file /my/directory/named/A/

Which of the answer options replace the INSERT CODE HERE when added independently if we compile from /my/directory?

public class Bird { }

Errata OCP Java SE 11 Programmer I Study Guide, in Chapter 1, in Review Question 16,

The answer is written as only D option. But it should be B, D, F.

B --> javac named\A\ compilation works
D --> javac named\A\ compilation works
F --> javac named\A\ compilation works

Could you possibly check it please?

Errata OCP Java SE 11 Programmer I Study Guide, in page 13, in table 1.1, It is written that Single-file source-code command is for programs with one class. But it should be written as `For programs with one file`.

It will be better in this way. Because there may be more than one class in a java file.