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

# ilkay Polat

Greenhorn
since Jan 31, 2020
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
1
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
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?

1 week ago
Here is my example:

int x = 4 + 3 * 5;
System.out.println(x);

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.
1 week ago
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.
1 week ago
Also what do you think Jeanne Boyarsky?
1 week ago
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.
1 week ago
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?
1 week ago
So what do you think Jeanne Boyarsky?
2 months ago
Yes I have tried all of them. I think those 3 options are the answers.

2 months ago
B) package my.directory.named.A;
D) package named.A;
F) package A;
2 months ago
Yes this question is from the Boyarsky and Selikoff book.

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

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

INSERT CODE HERE
public class Bird { }
2 months ago
Hi,

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\Bird.java compilation works
D --> javac named\A\Bird.java compilation works
F --> javac named\A\Bird.java compilation works

Could you possibly check it please?
2 months ago
Hi,

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.
8 months ago