Tim Mousaw

Greenhorn
+ Follow
since May 05, 2024
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
1
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
6
Given in last 30 days
6
Forums and Threads
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

Recent posts by Tim Mousaw

@Piet
Yes, that's perfectly legal. You're taking an instance of a String and calling the equals method on it with a method reference. If used in a stream method like filter assuming strings in a collection it would filter for all Strings that were Yes (case sensitive, or else you should have used "Yes"::equalsIgnoreCase).
The relevant paragraphs are as follows:

Lambda expressions, or lambdas, allow passing around blocks of code. The full syntax look like this:


The parameter types can be omitted. When only one parameter is specified without a type, the parentheses can also be omitted. The braces and return statement can be omitted for a single statement making the short form as follows:


While I understand this shows the most abbreviated form, it begs the question of where b comes from. And using the same body as the full syntax may lead to one believing the latter is intended to be the short form of the former. It may be more straightforward to use a different body (e.g. a -> a.toUpperCase())

The summary gives the full syntax of a lambda expression as:


It then goes on to describe the syntax of the short form and gives the lambda as:


While this could be valid assuming b is defined in an instance variable, static variable, local variable, or method parameter (for local variable and method parameter, only if final or effectively final) in code that is omitted, it seems more logical to think the authors intended to show the abbreviated form of the previous full syntax. That is:

I wasn't questioning whether between truncates. I was simply asserting the statement didn't follow as rounding would have the same net effect.
The full context is as follows. The line the paragraph describes is:


The full paragraph is:

In the fourth example, we start with the third rule, which tells us to consider 1 + 2. Both operands are numeric, so the first rule tells us the answer is 3. Then we have 3 + "c", which uses the second rule to give us "3c". Notice all three rules are used in one line?



I suppose the authors' intent could have been, "Do you notice all three rules are used in one line?". Like I noted in the topic, it's minor and probably doesn't make a large amount of difference. In my opinion, it reads more to me like a statement rather than a question. But I could see an argument that the question mark is intended.
In the sidebar on page 203 it states:

...


The first print statement shows that between truncates rather than rounds.
...



However, the result would be 1 even if it rounds, so the first print statement doesn't actually show that...
At the end of the fourth paragraph, it states:

Notice all three rules are used in one line?



This is a statement and should use a period at the end of the sentence.

Try changing the encoding to platform default and to UTF‑16 and see what happens.



Notepad++ supports both UTF-16 big-endian and little-endian. I updated the default to these and compiled the same program and got many errors. I'd include the errors below, but it makes the post too long. If I compile either of these files with the -encoding UTF-16, they compile and run just fine in Git Bash.

I also tried the same file in Ubuntu 22.04.3 LTS on WSL 2. Created it using the vi editor. It compiled and ran on my Linux installation no problem without specifying the encoding.

In reality, many different text editors use many different encoding settings. I think in Notepad++ you can configure the encoding to use for new files, so if you set it to the system locale's default encoding, you won't have to specify the -encoding option when calling javac.



I checked my preferences in Notepad++ using Settings -> Preferences -> New Document and the default is already set to UTF-8. So, I'm confused why this doesn't just work assuming javac pays attention to the encoding of my source file.

But the easiest way to deal with all of this is to simply limit the characters you use in source files to those that can be encoded in 7-bit ASCII.



Unless I'm mistaken, there's no way to render € with 7-bit ASCII. While I understand what you are saying, limiting myself to 7-bit ASCII seems to make the point my post impossible.
I used Notepad++ and the file itself is UTF-8 encoded. At least, according to Notepad++ it is...
Ah, I just re-read this and realize my mistake. It says it is in scope only inside the initializer. Not that it is in scope on line 7.
The rationale behind why line 7 does not compile is incorrect. It states:

Finally, line 7 does not compile because fins is in scope and accessible only inside the instance initializer on line 3, making option D correct.



I believe this means to say that fins is out of scope.
I meant to mention I am running Windows 11 Home.
After reading page 35 about the valid identifiers, I got to be curious about whether $, ¥, and where valid variable names on their own. I wrote a small java program:



To my surprise, when I tried to compile this from Git Bash via javac VariablePlay.java, I got the following exception:


I then commented out lines 5 and 6 and was able to run and get "foo" and "baz" to print out. What I discovered is that I believe my default encoding is causing the euro symbol to not compile. If I instead compile with javac -encoding UTF-8 VariablePlay.java, it successfully compiles and I get "foo", "bar", and "baz".

I did see in the Errata OCP 17 Developer Study Guide topic that there is a comment that the only currency symbol we should expect to see on the OCP 17 exam is the $. So, this is more a comment to the curious observer on this fact. Perhaps something to note in a future version.
The explanation for the answers for question 23 seem off. It states:

Lambda expressions with one parameter are allowed to omit the parentheses around the parameter list, making C correct.



However, answer C is:


There are parentheses around the parameter list.

The explanation about the other correct answer is:

The return statement is optional when a single statement is in the body, making option F correct.



However, answer F is:


The body of answer F includes the return statement.


vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |