Ian Heff

Greenhorn
+ Follow
since Mar 15, 2001
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 Ian Heff

Sorry Jim for posting a close question. I didn't realize that it was that close to an actual SCJP2 question. I guess the wording was why it was so confusing...
I took the exam yesterday and passed with a 67% 40/59. I am not a JAVA guy more a VB guy. I had no reason to take this test other then just to learn the language. I don't even know if I will ever even use JAVA but at least I now know it. Can't hurt, right? This exam is very reasonable. It really is a test on the fundamentals. Let me give you the results of my mock exams and some advice to give you confidence. First for my exam prep. I read two books First, "The Java Programming Language" (Third edition) by Ken Arnold. I read Chapters 1-10 and then skimmed some of the others like I/O that pertained to the test. The other book I read was Exam Cram. The first book is good for learning the basics and the second was good exam work. The majority of my focus was on mock exams. I seem to learn better from seeing than reading. So here were the results. I took several right off the bat a received in the 50-55 range. Then I took Marcus' three exams 53, 55, 53. Not quite good enough. Then I got JQPlus since I had about one week to the exam and had yet to pass a mock exam over the passing mark of 61%. So the results 40, 45, 65, 50, 53, 53, 50, 55 and the random 88. I only got so high on the random since I had already seem 95% of the questions through the other tests. So the real exam is kind of easier than allot of the mock exams so don't worry if you are struggling on them.
Now for exam advice. I/O was very easy I got 100% on that basically all you need to know is what parameters the various methods take it's as simple as that. And almost all of them only have one parameter anyway. Oh yeah and know that setting true as a second parameter in some of the methods allow you to append to the file and not overwrite it. And now how to move the file pointer with seek(). All the questions were very familiar from mock exams. Maybe 5 or 6 I/O ?'s.
Threads were just as easy got 85% on that 6 out of 7. I thought these would be tough but again the mock exams taught me the fundamentals and that�s all you need.
There was one 3-4 on AWT. Nothing hard. More theory than code maybe one code sample on button placement.
There was 3-4 fill in the blank on what is the output of code using various functions. Again nothing that you haven't encountered.
There were 2 on incrementing operators. A bunch on value of array elements and what the defaults are set to for like int, boolean and the such. There was one on GC. When object is available to be colleceted. I got it wrong and thought I knew garabage collection so look at the mock questions that show a segment of code and a ask after which line the object is available. That is the type you will most likely get on the SCJP2 exam.
That�s about all I can remember so don't sweat the test just understand the fundamentals and you will be all set. One other piece of advice understand Pass by reference and pass by value. There are probably 4-5 that pertain to that. And relax during the test just roll it if you don't know the answer just guess, mark it to come back and don't even think about it till you come back to it and focus on the next question.
Best of luck,
Ian
21 years ago
Sony,
I am unsure here but my best guess is that maybe certain escape characters are allowed and others are not. Hopefully someone else will chime in a give us both clarification.
Ian
Bill, I got a small mock test (~10 ?'s) from a friend of mine. He is working on creating an entire mock exam so maybe if he finishes and feels it is satisfactory he will post in on the web...
Sony,
They are character literals that represent escape sequences.
'\u000A' is a newline
'\u000D' is return
I would think your choice c would yield an error as well since
'\u000C' is a form feed
Other ones to watch out for '\u0009' tab, '\u0008' backspace, '\u005C' backslash itself, '\u0027' single quote, '\u0022' double quote
Hope this helps!
Ian
You are right, Andy. I forgot to add the semicolon on the last one. Good catch!!
Ian
Thank you all. I think I finally see the difference. Now its time to code some examples to ground it.
Thanks,
Ian
Thanks that has helped, but concider this modification:
public class Ian{

static int str = 22;
static void modify(int a){
str = a;
str++;
str++;
}
public static void main(String args[]){
int str = 21;
Ian i = new Ian();
modify(str);
System.out.println(i.str);
}

}
The ouput is 23. So the class variable str whose value was 22 is modified to 23. So I am still confused.
Along the same lines concider the slight modification of the orginal code: I am sure the concept is the same as above but I just don't have it yet.
public class Ian{

static String str = "Outside variable";
static void modify(String a){
str = str + " addition...";

}
public static void main(String args[]){
String str = "Inside variable";
Ian i = new Ian();
modify(str);
System.out.println(i.str); // line 4
}

}
The result is "Inside variable addition..."
So the value of the class variable "str" did indeed get modified. Now I thought Strings are immutable. Or is the String "str" in the method "modify" shadowing the class Variable "str". Since I call i.str on line 4 of main I would think that this is referencing the "immutable" class String str. Any insight into what�s going on here would be appreciated.
Thanks
I am having a real hard time grasping when a value gets passed by reference vs. when it gets passed by value. I have searched through the archives on this page and found some good stuff but I still don't quite have it. Here is a little example I typed up:
public class Ian{

static String str = "Outside varaible";
static void modify(String a){
str = a;
}
public static void main(String args[]){
String str = "Inside variable";
Ian i = new Ian();
modify(str);
System.out.println(i.str);
}

}
Now when you compile and run this program it returns Inside variable. Now I thought that since i is of Type Ian it would take on the value of str in Ian which is "Outside variable". I realize that I did pass a "copy" of the String str to the method modify but I didn't think that it would modify the value. I really need to figure out when a value gets modified and when it doesn't. Any hints?? Or can you modify this code so that it shows an example of pass by value.
Thanks,
Ian
I would like a few clarifications on the following mock questions
Select valid arrays declarations or initializations (Select 3)
a) int a[] = new int[5];
b) Double d = new double[4];
c) Char []c = "Element";
d) Object obj = new double [8];
e) int ab[][] = {0,1,2} {1,5,6}
f) int []q = {1,2,3}
Now I didn't think there was three valid since a, f and I think b,c,d are in the wrong form and that leaves f but there is no semi colon on the end of the line and also there is no comma separating the two array groups. Are these things not needed for some reason?
2) What can the throw statement throw? (select 4)
a) Error
b) Event
c) RunTimeException
d) Object
e) Exception
f) Throwable
Now here I am thinking a, c, e, and f since these are all derivations of error handling.
[Third question deleted because it turns out to be extremetly similar to a real exam question (though Ian didn't know that) - Jim Yingst]
Thanks,
Ian

[This message has been edited by Jim Yingst (edited March 31, 2001).]
Many Thanks to you all. It's perfectly clear now
Ian
Hi
I am having difficulty converting base 10 numbers to Hexadecimal and octal numbers. I have not been able to find out the rules for conversion. Can someone please explain how to convert to these number types?
Thanks
Ian