Viacheslav Yakovenko

Greenhorn
+ Follow
since Jun 06, 2020
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Viacheslav Yakovenko

Olivia Johnson wrote:
The explanation says

Line 10 includes an unhandled checked IOException, while line 11 includes an unhandled checked FileNotFoundException

but none of BufferedInputStream's constructors declare a checked Exception.



If you compile code as it is, compiler will complain only about incompatible casting from Object to Bird.

If you fix it adding appropriate cast, compiler will show compile errors on other lines, including line 9 - "exception thrown from implicit call to close() on resource variable 'is'".

Compiler flags unhandled exceptions, thrown by close() method of the variable in try-with-resourses statement, at the point of declaration of such variable.
I think an example will better demonstrate what Oracle was trying to say. At least I didn't understand it until I came up with this example.



Class Person is technically immutable. You can't modify its state, at least without using reflection. But you can supply a mutable subclass (or override getter method), and it can break your program.
Hi.

Have you tried to contact local testing center and to ask what kind of ID they accept?
I was in the similar situation, but registered using transliterated name and surname. I was told that combination of local passport (it has only Cyrillic script) and International Travel Passport would be enough.
Here is general Pearson Vue ID policy.
What's the reason to keep 1Z0-817 exam, when candidate can simply do new 1Z0-819 one?
I was trying to show how Java's evaluation of operands (always from left to right) corresponds to right associativity of assignments. Exceptions are just a method to stop execution at the right moment (debugging via exceptions )

is equivalent to

First we evaluate 'a', then evaluate 'b', then evaluate 'c', then execute assignment b = c, then execute assignment a = (b = c).
Plus, this code sample shows that Java first computes index in array, then computes new value, then performs range check, then assigns new value. It gives us a way to stop execution during assignments.

First versions of my code sample had similar to the peek() method. I can't find good explanation why I switched to exceptions Example for jshell nails my idea.
Thanks, I really mixed up evaluation of operands and operator precedence, especially for assignments.
Hopefully, next code sample will help someone else to sort things up
Thanks a lot!
One minor clarification - not all Java code is executed left to right. For example, assignments are executed from right to left.
Previous discussion here.

I don't understand, why precedence x-- versus ++x is discussed regarding following expression:

Multiplication and division are left-associative and have lower precedence than increment/decrement. So, first we compute value of (++lion),  then evaluate constant 5, then compute multiplication ++lion * 5, then compute value of (lion--), and in the end perform division:

Even more,  precedence of x-- versus ++x have meaning only when we compare these operators with others (operator A is higher in the table, than operator B, operator B is higher than operator C, so operator A is higher than operator C), because Java doesn't allow using them simultaneously.
Do I miss something?