Axl Rose

Greenhorn
+ Follow
since Dec 18, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Axl Rose

Rob,
according to the JSL 8.1.2
interfaces are never inner.
can you explain
muhammad,
read the exam objective, every thing is mentioned there..
but basically you need to master the following:
1- you must know the advantage of using every single collection class (Maps, treeMaps, array, vectors, sets, linkLists...etc).
2- You must be able to make apropriate selection of collection class that better suit a specific behaviour.
the best way to master these is not to look at mock exams questions, but to read the API first, and then get your hands dirty and write some code.

Jamal, you are not totally correct.
see JLS inner classes.
basically inner classes: are classes that are not decalred 'static'.
nested classes: are classes that are static.
it doesn't matter if the class is inside a method or not.
ok Mr Hasan( ov )
ohh, and one more advice to you..
most of these mock exams on the net are written by people who don't have enough experience in the Java language, and they didn't set the exam themselves..now obviously this question asks you a question that require you to only look at the code and, see what is being written, then answer the question.. it doesn't go deep into making you think about what happen at runtime or at compile time or if the exception is a subclass of a parent exception.... etc.
thats why the answer is simple and doesn't have much thinking into it. (which is not the case in the real exam).
so next time if you see a mock exam question that doesn't make sense to you, don't think that they are correct and you are wrong, ask your self what is the background of the person who have written the question first.
hmmm.
lets take answer a and work through it:
a)The main declare that it throws SomeThrowble .. (so far this is correct, the main method does declare that it throws SomeThrowable..
but throws MyThrowable ..(you can see this is not correct since inside the catch statement it throws e, which is of type SomeThrowable.
hope that helps
Hi All,
Does anyone know if the GridBagLayout is part of the certification exam?
according to 'The Complete Java2 Certification Study Guide' book, its not in the exam, but according to the 'Exam Cram', its in the exam.
Chipada,
please make sure that these output values that you specified are correct,
the first class output is 4 0 1
and the second question output is not 22 , it is 16
some of these questions answers contains errors, check with a compiler first.
Yes, Ananda , you are right
starting from left to right , java evaluate its expressions.
so, 1+2+"strange" will take the following steps:
1- take the first expression 1, and the second one , 2, then add them, giving 3
2- take 3, and the next expression which is a string, and add them, remember now this is not the arithmatic addition, this is the string concatenation +, becuase we have a string, so a new object is created with of type string and have the value "3strange"
if you follow the same logic ,the second statement should make sense.
hope this help
first you need to convert int (decimals) to binary
the way to do it is to add up the binary positions to make
up the interger you want
for example
if we have 128, and we want to know its binary equivalent
1000 0000 is the binary equivalent
each position in the binary representation stands for a decimal
value, so starting from the right and going to the left
128 64 32 16 8 4 2 1
you notice that we have 8 numbers, corresponding to the 8 binary
positions.
so we find that 128 is actually 1000 0000
if we want for example 4 then it will be 0000 0100
if we want 10 , it will be 0000 1010
as so on.
I think the answer should be line 4, I will tell you why:
a points to "hello"
b points to "byte" //line 0
c points to "byte!" //line 1, notice that this is a new string
d points to b, which points to "byte" //line 2
b now points to a, which points to "hello" //line 3
notice that at this stage "byte" is still being pointed at by d
d now points to a, which points to "hello" //line 4
notice now that "byte" is not being pointed at by any other
variable. so it is available for GC
once the Java Virtual Machine (JVM) finished with line 4, and
before it jump to line 5, it will mark "byte" to be eligible for
GC, remember that GC can start AT ANY TIME , no guarantee when
it will start, and this answers your second question , the JVM
does not wait for the method to finish to start its GC, because
if it does that, the method may take valuable memory location
that it does not really need.
GC got nothing to do with when the methods will be terminated.
>>
I think the answer should be
0x1000051F
I followed the following way to derive the asnwer
0x800028FF is 1000 0000 0000 0000 0010 1000 1111 1111
this shifted >> 3 gives
0001 0000 0000 0000 0000 0101 0001 1111
which is
0x1000051F
Amar, you need to set your classpath so that it points to the directroy of your Hello.class file.
you can do this easily from the DOS
let us assume that your Hello.class file is in the following directory
C:\Amar\classes\Hello.class
then you set the path in the dos like this way
C:\>set classpath=%classpath%;c:\Amar\classes
and then you can run the class using <java Hello>
if your class is inside a package, you follow the same step
and point to the directory of your package.
Hope this can help
you are wrong Himanshu,
the code will compile OK, try it
but it will give a compile error if you try to use the label any where inside the loop
I think what you need to do is a simple set classpath statement.
assuming that you are using a dos command to compile and run your program , you still need to set the class path of your package so that other classes (any where) can see them in an import statement.
for example (assuming that you are working in a dos window)
you use
C:\>set classpath=%classpath%;c:\jdk1.3\jre\classes
after that, if you try to compile the class that contains the import statement, it should not give you any error about can't find the class error message.
if you are using some other development environment like the JBuilder or Kawa, there is an equivalent setting,but using menus rather than standard DOS style.
buttom line: your problem can be solve if you play with your classpath setting.
try the above method, if it didn't work , tell me