kevin goon

Ranch Hand
+ Follow
since Jun 12, 2001
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 kevin goon

Hi,
Please, excuse my being bold but I have a question.
I just finished SCJP for platform 2.
I would like to further pursue next level certification and I was wondering if anyone could give me some direction as to where to go from here. =)
Also, What's the difference betweeen SCJD for Java 2 platform and for 2EE platform?? Which one should I pursue??
Thank you very much in advance. =)
Sincerely
kevin
I didnt really read too many books except I did read RHE twice and had been doing some Java programming based on school works.
I downloaded Java shareware(kawapro) and tried to compile anything that i was unclear. For my exam, mostly questions from JQuest and Marcus Green were helpful. I also had 100 on rules roundup. I didnt really seek to do as many different kinds of mock exams as there are on the internet. I did however focused on the Marcus and JQuest to make sure I was 100% clear and could handle any variations of the mock tests.

hope this helps
good luck
19 years ago
Hi!!!
I took the exam today and passed with the score of 84.
I'm a college student in New Jersey.
I want to thank all of you who helped me out with the questions. Thank you so very much!! =) Without the help, I would probably have missed some of the questions with the simialr topics.
The only book I read was RHE and some other Java book(I forgot the name of it, but with red cover and a guy with grey hair on it=) I've read RHE book about two times and went back to both books for reference if I needed. During the past few weeks, particiapated on the forum alot and it really helped me not miss out some of the confusing questions brought up by other people. I think It was one of the most helpful thing to participate on the forum and try to help people with the best possible resources at hand.
Anyways,
My exam wasnt that bad except I had missed out some Threading q's and inner class scopes. Some questions on IO, Randome Aceess File, adding buttons to Frame, InputStreamReader,etc. A very general question on GridBag(no brainer, i was lucky=) static, interface, array declarations, switch(know if no break, fall thru!!), making an abstract class, java.lang.Math, etc
No writing code, all MCs , Two hours was more than enough so i recommend anyone to take time and make sure you get the ones you are comforatable with.
For me, I used the blank paper for various questions such as traking variables for loops, references and Layouts.
Again,
I really appreciate all your helps and hope to drop by occationally to participate in the forum.
Thank you and javaranch=)
regards
kevin
19 years ago
int m = 0;
while (m++ < 2)
System.out.println(m);


prints 1,2 why?
3.java.util.Arraylist are described?
a)The elements in the collection are ordered
b)The collection is guaranteed to be immutable.
c)The elements in the collection are guaranteed to be unique.
d)The elements in the collection are accessed using a unique key
e)The elements in the collection are guaranteed to be synchronized

Q2) Which descrive HashSet ?
1) elements stored are unique?
2) have unique keys?

Q3) below compiles(with no further change)
char c = '\ucafe';
WHY?

thanks!!! X100
CAn notify() and notifyAll() possibly stop execution of a runing thread?
If you call start() on some thread object in main and You write println just after the call, why does it print first then run()?
For example,
static void main(String s[]){
//made a thread t
t.start();
System.out.println("This Prints First before the run() is executed, Why?");
}
thank you!!!

Hi, I posted this question before but It wasn��t clear what the correct answers are. i'd appreciate it if someone can quickly shed light on this. Thank you.
public class SyncTest
2. private int x;
3. private int y;
4. private synchronized void set X (int i) x=i;
5. private synchronized void set Y (int i) y=i;
6. public void setXY (int i) set X(i); set Y(i);
7. public synchronized boolean check() return X != Y;
8.
Under which conditions will check() return when called from a different class
A. check() can never return true
B. check() can return true when set XY is called by multiple threads
C. check() can true when multiple threads call set X and set Y separately
D. check() can only return true if synchTest is changed to allow x and y to be set
Separately
ans): a,d ???
Q2)
Conside below

public static void main(String args[] ){
X that = new X();
X hey = new X();
(new Thread(that)).start();
(new Thread(hey)).start();
}
public synchronized void run(){
for( ; ; ){
x++;
y++;
System.out.println("x=" + x + ", y=" +y);
try
{
Thread.sleep(1000);
}
catch(Exception e){}
}//end of for loop
}//end of run()
}//end of class
Output?
I thought by using synchronized run(), only one Object thread is run and that the other Object thread("hey) must wait till the first one("that") is finished. thus producing
1 1
2 2.. and so on..
but when i ran it, it output
1 1
1 1
2 2
2 2 ... Why? I think I'm getting very confused with the thread and how the idea of synchronization works..
Can Someone give a really Easy and Clear explanation of synchronization??? on methods and blocks??
Thank you so much!! =))
This is from JQuest.
Here is part of the code for a class which implements the Runnable interface.
1. public class Whiffler extends Object implements Runnable {
2. Thread myT ;
3. public void start(){
4. myT = new Thread( this );
5. }
6. public void run(){
7. while( true ){
8. doStuff();
9. }
10. System.out.println("Exiting run");
11. }
12. // more class code
Assume that the rest of the class defines doStuff, etc and that the class compiles without error. Also assume that a Java application creates a Whiffler object and calls the Whiffler start method, that no other direct calls to Whiffler methods are made an that the Thread in this object is the only one the application creates. Which of the following are correct statements ? [Select two valid answers]
1.doStuff() is never executed 2. line 10 will never be reached
Why these two answers??
Please, explain the following problems from JQtest
Q1)
Imagine that there are two exception classes called Exception1 and Exception2 that descend from the Exception class. Given these two class definitions,
1. class First {
2. void test() throws Exception1, Exception2 { . . . }
3. }
4. class Second extends First {
5. void test() { . . . }
Create a class called Third that extends Second and defines a test() method. What exceptions can Third's test method throw? Select one valid answer.
ans) no checked Exception, why?
Q2) "slight modified"
class test {
public static void main(String arg[]) {
String args[]=
{"Mighty", "Mouse"};
Changer c = new Changer();
c.method(args);
System.out.println(args[0] + " " + args[1]);
}
static class Changer {
void method(String s[]) {
String temp = s[0];
s[0] = s[1];
s[1] = temp;
}
}
}
ans) prints Mouse Mighty , but why? I know this seems trival question but I'm thinking in terms of the copy of the reference of original array passed in as an argument. So my guess was that it wouldnt change the actual data values in the object array when using s[] in the local method.
thank you!
i think answer is "never in the method" since the object is still being refered by str. if u set str= some other object, then it would be eligible for gc
Hi,
As my exam draws near, I'm wondering if anyone can answer the following questions.
1. Is there a question that is not supposed to have an answer?
2. Is there penaly for getting it wrong? (In other word, is it better to leave it blank if u dont have a clue and have to guess?)
3. If u dont finish all the questions in time, it gets automatically submitted(You still get the points for the questions u answered right?)
4. Is the exam hard? =)) <just kidding >
thanks for attention
Hi,
I'm not sure if below is right.
You said,
public void piggy(String sName){
/*2 Now wiggy is appended and the string becomes "vandeleur wiggy" if I am right*/
sName = sName + " wiggy";

I think sName here is only a local variable so " wiggy" part wont be attached to the original data.
In my opinion, when the start() is called, the System(remember platform may determine which thread gets to run first) decides which one between your main thread and the t thread gets to run first. If main gets to run first, then system prints out from the main method first and "trigl-whatever" is printed. If t thread is run first , then it goes in to run and concatenates 0-4 and returns to called(main) and finally prints the newly referenced String.
hope it helps
regards
Hi,
Just wondering if anyone else had noticed the constructor for the FileDescriptor class. Im not sure but i think but my RHE book back section says there's an int argument for the constructor but the sun API has no such constructor, only default with no argument. Just wondering which one I should follow..
thanks


������14.public class Syntest
public static void main(String []args)
final StringBuffer s1=new StringBuffer();
final StringBuffer s2=new StringBuffer();
new Thread()
public void run()
synchronized(s1)
s1.append("a");
synchronized("b")
System.out.println(s1);
System.out.println(s2);
.start();//not error
new Thread()
public void run()
synchronized(s2)
s2.append("c");
synchronized(s1)
s1.append("d");
System.out.println(s2);
System.out.println(s1);

.start();

output?
a)print ABBCAD
b)print CDDACB
c)print ADCBADBC
d)The output is a not-deterministic point because of a
possible deadlock condition
e)The output is dependent on the threading model of
the ysstem the program is running on.