Jim Kilthau

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

Recent posts by Jim Kilthau

The Core Java books are Ok if you're coming from a C++ or VB background, as the authors make many references to those languages in an attempt to remove confusion between them. For someone like myself, who came from a non-OOP background, I wasted a lot of time trying to learn from these books. It was a major mistep for me when I was trying to get started.
I truly wish that I had started out with either The Programmers Guide to Java Certification, or the Java 2 - Complete Reference. These two really dive into the fundamentals and are the best of the lot. The Complete Reference is probably the most thorough in terms of code examples. BTW, neither of these books spend much time on advanced topics, so you should look elsewhere for that.
22 years ago
I'm not sure if I made this clear in my reply, but... the other,
"non public" classes in your program DO NOT have to be inner classes.
22 years ago
No offence, but Anil is incorrect. You can have as many classes in one program as you want. The reason you can only have only one public class is because the public class name is the same as the source file name. Of course you can't have two source files with the same name in your source directory. Otherwise the public class and the rest of the classes in your program are no different in terms of status or ability.
In this program, you have two seperate and individual classes;
_______________________________________________________________
public class TestIt {
public static void main(String stuff[]) { //program starts here
OtherClass OC = new OtherClass(); //create object
}
}
class OtherClass {} // do nothing
_____________________________________________________________
When you compile the above, you must name the source file TestIt.java, because that's the name of the public class. The
compiler will create two class files; TestIt.class & OtherClass.class. These two will be used (interpreted) by the JVM when you run the program.
Here's a program with an inner class, named InnerClass;
____________________________________________________________
public class TestIt {
public static void main(String stuff[]) { //start to run here
OtherClass OC = new OtherClass(); //create object
class InnerClass {} // do nothing
}
}
class OtherClass {} // do nothing
____________________________________________________________
This class is subordinate to TestIt,unlike OtherClass. When you compile the above program, you get the two original class files, along with this one: TestIt$1$InnerClass.class. You can see by the name that this class has an inherent dependency on the outer class.
If you really want to get a good grasp of all of this, I'd recommend either of the following excellent books: Programmers Guide to Java Certification (Mughal-Rasmussen) or The Complete Java Reference (LOTS of great fundamental exercises) by Naughton-Schildt.
Have fun and let me know if I can help
------------------
22 years ago
I checked the errata on the Exam Cram book and Bill Brogden
says "don't take this questions seriously".
The following is an excerpt from a LENGTHY discussion he does on this topic in which he disassembles the code and gets in WAY over my head. I you really want to become an expert on GC, I suggest you start here: http://www.lanw.com/java/localvariables.htm
___________________________________________________________
Some Thoughts On Java 2 Exam Cram, Chapt 8 Question 7
It turns out that this question is a lot more interesting than I thought. The answer seems to depend on how
clever the JVM garbage collection is.
What I was trying to get at with this question is the behavior of the garbage collector with respect to local variables in a method. The question is complicated by the scope of the variable, which is restricted to the for loop.
-Brogden
I've been reading many posts here about the next exam compared to the earlier version. It seems that the new version is very similar in focus, although the 90 minute time limit was a problem for me. Most people felt the material was average in difficulty.
I would agree with that, I just didn't know my stuff too well.
If you look at the posts here from people that took the exam during the last month, you'll see that many of them give a breakdown as to the number of questions per category. It would be easy for you to chart the estimates and find out where you should concentrate your studies. That's what I'm doing anyway and I'll find out on Tuesday, when I retake, how intelligent this approach is
I'll tell you this much; you must be quick at figuring out code and you need to be certain about threads, overriding/overloading and flow control/exception handling.
Good luck, Jim
Thanks very much for taking the time Maha, that validates my understanding and now... I can move on
Best, Jim
I'm doing Chapter 6 in Mughal&Rasmussen's Guide and questions 6.13 and 6.15 don't make sense to me. I can't get the code for 6.15 to compile, as the book states it should. Also, the answer to 6.13 just doesn't sound right to me. Here's the code for 6.15;
abstract class MyClass implements Interface1, Interface2 {
void f() {};
void g() {};
}
interface Interface1 {
int VAL_A = 1;
int VAL_B = 2;
void f();
void g();
}
interface Interface2 {
int VAL_B = 3;
int VAL_C = 4;
void g();
void h();
}
There are answers a-e and all but e) are errors. The book suggests that this code will compile but I get errors, which make sense to me, such as; f() and g() in MyClass are in error since they restrict permissions on the same methods in Interface1. The default in the interface would be public, while the default in the abstract class would be package.
__________________________________________________
Question 6.13 asks;
Given the following variable declaration within the definition of an interface, which of these declarations are equivalent to it?
int answer = 42;
Select all valid answers.
a) public static int answer = 42;
b) public final int answer = 42;
c) static final int answer = 42;
d) public int answer = 42;
e) final int answer = 42;
Since, regardless of how they're defined, interface variables are supposed to default to public static final, I don't see how any of these would compare, although I chose answer c).
The answer given by the book is: a, b, c, d and e. "All of the declarations are equivalent. Interfaces cannot have instance variables, since they do not define a concrete class. Interfaces can define constants by defining variables that are final and static. All variables in interfaces are therefore implicitly static and final. In addition, all declarations in interfaces are implicitly public."
Well, now I'm REALLY confused. I think the only way I can agree with this answer, is if the varibles were defined within an interface, themselves. I assumed the variables were the equivalent in a generic class, I don't know.
This is probably more than I need to understand for the exam, but I want to clear up my apparent confusion. Can anyone shed any light on this for me, or refer me to a good source on the topic?
Thanks in advance, Jim
------------------
Nasir, I did a little checking around on this and it looks like the answer is not clear cut. At the Sun site, the Java Tutorial seems to contradict itself by making these three statements:
"Only when that thread stops, yields, or becomes not runnable for some reason will a lower priority thread start executing."
"The yield method gives other threads of the same priority a chance to run. If there are no equal priority threads that are runnable, then the yield is ignored."
"Rule of thumb: At any given time, the highest priority thread is running. However, this is not guaranteed. The thread scheduler may choose to run a lower priority thread to avoid starvation."
The document states three times that the yield() will be ignored if there is not an equal priority thread in a runnable state, so I assume that this is the case and that your assumption is correct. It does seem that the scheduler can opt to give time to a lower-priority thread, when it deems necessary so's not to "starve" the other thread. I think this all depends on the version and configuration of the scheduler though.
Have fun
Clear as mud, huh?
You asked about preparing the mind. I started taking a nutritional supplement called Brain Elevate (made by Earth
Organics) which is comprised of Huperzine, L-Glutamine and
Ginkgo Biloba Extract. These incredients a known to support and nourish cerebral functions (synapses). I'm not big into herbs and vitamins, but I've noticed a distinct improvement in my short term memory and I also think that I'm retrieving things faster.
You should also do some running (or whatever cardio workout you like) as this will not only increase oxygen to the brain, but it
will also take some of the brains attention off of the body.
Lastly, I find that meditating for 20 minutes a day reduces some of the mental clutter that gets in the way. Frequent sex (no joke) also seems to have the same effect.
Good luck
It occurred to me that the following experience might be useful to some in this forum.
When I took the exam (and flunked) a month ago, Sun had
just released the new version and I complained to them, via
email, about two problems with the exam. I was very delighted
to get this terse reply; "In order to hava strong chance at passing this exam. You must have experience with writing codes and programming." Brilliant, huh??
The good part, was that she attached a free voucher to retake the exam Very generous of Sun.
Hopefully Sun has corrected the problems as I'll be giving the exam another shot on Friday. The issues were; a reference to line 24 in a code sample, which was a blank line, and the fact that they did the survey at the beginning of the exam, WITH THE CLOCK RUNNING! When I reported the problems I admitted that I would have flunked anyway, so this little surprise helped to heal my pain.
I never see any posts here from people who fail the exam. To this silent minority; "keep a stiff upper lip, and get back at it".
Many thanks to the VERY nice and sweet people who post here. I've never seen such a nurturing group of people. I suppose it's not politically-correct to say this but... I partly attribute it to the large number of Indian nationals who participate here. As a consultant, I've worked "shoulder to shoulder" with many Indians and, generally as a group, they are a very fine lot.


------------------
IMHO, I would suggest that you take 1-2 mock exams per week.
The reason for this is that the new exam only gives you 90 minutes and if you're not quick at figuring out the code samples, you'll pay for it, like I did.
I've seen a lot of confusion here about null, true, false etc.
and the reserved words/key words situation. I don't know if this has been posted previously, but I think this page at java.sun addresses it explicitly.
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
One bad question. One of the first few questions I got on the new exam involved a code sample. I was queried as to what the resulting output would be on line 24. Line 24 was BLANK!!! None of the answers would have been appropriate as line 24 generated nothing. I had to guess that the result they were looking for was from the first line above the blank. Of course I can't know if this assumption was correct.
This was a big problem for me as, I knew that this was a new exam, and since it was so early in the test, I began to doubt the accuracy of the questions. Losing a couple of points here was not that big of an issue, but the anxiety that I felt did throw me off a bit.
Also, after reviewing the % results of the different categories of the exam, I devised a simple chart which showed the possible %'s that could be generated by a particular number of questions. I did this so I could approximate the number of questions in each group. Some of the %'s on the results sheet could not have matched any reasonable range of questions, unless they "rounded down". Gee... give me a break guys
Good luck to all, Jim
Nice going Mapraputa. I took the exam today and got totally
"spanked" with a 33. I'm making the quantum leap from COBOL to Java and have just studied out of books. I was prepared to have 120 minutes to do the exam and had been timing myself for 2 minutes per question. In the end, I came up short about 20 minutes. I would have failed anyway, but racing through the final 15 questions killed me.
About the content of the exam, you said that you had no fill-in questions, I had three of them (results after a 'for' loop and also substring concatenation). This leads me to believe that there is not "one" exam, but possibly random-generated questions. Does anyone have information about this?
For anyone considering taking this exam... here's a rough breakdown on the questions I ran into (as memory serves :
3 re: string manipulation (concatenation)
2 re: stringbuffer
4-5 re: subclassing
2 - inner classes
3 - overriding (need to be able to spot Ok signatures at a glance
3-4 - overloading
1 - AWT question
2-3 re: arrays (understand the effects of storing references
also proper indexing)
2-3 involving wrappers
many of the rest were fundamental syntax questions. Strongly
suggest that you can "quote" chapters 2 & 3 of the Nutshell book.
I think that, in order to do well on this exam, you MUST have the fundamentals down pat, otherwise you'll squander the 90 minutes, like I did.
Also you must be able to correctly assess 'for' loops (i++ and --i) immediately, as there are many of them in the code examples.
Now, let me ask you... since I only scored a 33%, why would you bother to listen to any of the above?
I'll retake the exam in two weeks and, hopefully will pass this time.