Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!

A Lauran

Greenhorn
+ Follow
since Mar 01, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by A Lauran

I am confused by questions such as  "Which of the following exceptions are always thrown programmatically?"
So I thought this was a distinction between checked and unchecked exceptions, but it seems this isn't the case.

This was one of the qs on the practice exam from Sybex with the following options:
A - ArrayIndexOutOfBounds
B - ExceptionInInitializerError
C - java.io.IOException
D - NullPointerException
E - NumberFormatException

The answer says "All of these exceptions can be thrown programmatically, but the question asks which ones always are. An
IOException is thrown by many methods that read/write files and is always thrown programmatically. Similarly, NumberFormatException is thrown when convering numbers. The other three are thrown by the JVM"

I just can't get my head around what exactly it means by 'programmatically thrown'?

Jeanne Boyarsky wrote:Hi,
Please report the freezing/skipping to Wiley tech support at https://www.wiley.com/WileyCDA/Section/id-302036.html.

It definitely isn't supposed to do that! The questions in all three exams are different from each other. Some seem similar but are subtly different. We do that on purpose to make it harder to memorize the answers (so you can take the test more than once and still learn something)



Thanks Jeanne. That link isn't working for me

And thanks for the clarification! And am I right in thinking that history of scores etc aren't saved for our accounts?

Hi all,
Just a question about the Wiley Sybex online question bank - there are 3 practice exams on there..is it just me or do your scores/attempts never get saved for these or the end of chapter questions?

I just spent 1.5 hrs doing practice test 1 - the program froze in some places, skipped 4 questions, didn't allow me to step backwards to previous questions and din't give me the option to go back and look at my marked questions. Once i then submitted for grading, whilst i was reviewing my answers and the correct answers, it timed out. Logging back in I realised that not only does it not save any history.

Is there a way round this?

Also are the questions in each of the 3 tests separate/independent of each other?


thanks!
Right just retried setting the Classpath to C:\temp from scratch and it works!  thanks so much everyone
Thank you - but i'm still struggling to understand so I will copy my set up:

So I my folder structure like so:
C:\temp\pond\duck
and within here, I have a FatherDuck.java and BadDuckling.java



and



My classpath is sset to:
C:\temp
and my directory in the command line is
C:\temp\pond\duck

From the command line, I call javac FatherDuck.java which compiles to add FatherDuck.class to C:\temp\pond\duck

Now when I call javac BadDuckling.java, I get the above error.

Liutauras Vilda wrote:How about, just give a try?



So I set my classpath variable to point to C:\temp and am getting the same failure so my question was just to clarify whether that should definitely work ? (in which case, my set up must be wrong).

I tried calling javac and java in the command line and both were recognised which would suggest the PATH and CLASSPATH variables are set up correctly

Henry Wong wrote:

A Lauran wrote:
If it is assumed to be the current working directory, both classes live within pond\duck so why would it be able to see FatherDuck when compiling that but not when compiling another class?



The class that is being compiled is located from source, which is specified in the command line. The classes which are needed by the class that is being compiled is located from the classpath. Without the classpath being set, it is the current working directory. Since you are in the C:\temp\pond\duck directory, and the BadDuckling class needs the pond.duck.FatherDuck class, it will try to locate it in the C:\temp\pond\duck\pond\duck\FatherDuck.class file.

So, you either have to place the current working directory in the correct directory, or set the classpath to be the same.

Henry



Thank you, this makes sense! I definitely did not catch on to the fact that the required classes were being grabbed from C:\temp\pond\duck\pond\duck\FatherDuck.class

So am I correct in understanding that I'd have to set the classpath to C:\temp so that it looks in C:\temp\pond\duck.FatherDuck.class? And I wouldn't want to set it to C:\temp\pond\duck?

Henry Wong wrote:

A Laran wrote:
With my directory in the command line set to C:\temp\pond\duck, FatherDuck.java can be compiled successfully. But trying to compile BadDuckling.java I get the following error:



Try setting your current working directory to C:\temp, and compiling pond\duck\FatherDuck.java and pond\duck\BadDuckling.java files respectively. I am assuming that you don't have a CLASSPATH set, and in this case, the classpath is assumed to be the current working directory.

Henry



Hi Henry,

If it is assumed to be the current working directory, both classes live within pond\duck so why would it be able to see FatherDuck when compiling that but not when compiling another class?

Campbell Ritchie wrote:Welcome to the Ranch

Please supply more details of what you have written, because many of us don't have the book.



Sorry, new to this so here we go:

So we have two classes:


and



Both FatherDuck and BadDuckling are in the pond.duck package so I have a 'duck' folder within a 'pond' folder and have both classes saved there.

With my directory in the command line set to C:\temp\pond\duck, FatherDuck.java can be compiled successfully. But trying to compile BadDuckling.java I get the following error:

Hello,

I'm following the example on page 174 of the OCA sybex study guide which uses classes in two packages: pond.duck and pond.swan to show private and default access.

I've created two java files one for FatherDuck and one for BadDuckling as is laid out in the book but when compiling the two, BadDuckling fails with a 'cannot find symbol' error on FatherDuck.
Could someone explain to me why this is or whether I need to structure the two classes in some specific way?

Thanks!