Krishnamoorthy Sethuraman

Greenhorn
+ Follow
since Dec 12, 2005
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 Krishnamoorthy Sethuraman

With practice I think SCJP5 should not be tough... I took the two sample tests from K&B and also practised the whizlabs simulator for SCJP5. Some questions on API's from whizlabs were out of the certification objective. Was able to get only 70-80 in whizlabs practise tests. In the final whizlabs test got 90. Hearing others saying that whizlabs is tougher than the actual exam, was confident in taking the real exam. The sample test from K&B were in line(w.r.t to toughness) with the actual exam questions. Manually typing the code in a normal text editor without any autocomplete feature will be helpful from certification perspective. I used Jedit for practising...
17 years ago
Cleared SCJP5 today with 91%.
=====================================
Split Up:
Declarations, Initialization and Scoping - 100
Flow control : 81
API : 100
Concurrency : 87
OO concepts: 90
Collections / Generics : 90
Fundamentals : 90
======================================
Thanks to K&B for providing a good textbook and for all the members in this forum from whom I learnt a lot.

Thanks,
Krishna.
17 years ago
Change the class declaration as:
class Name implements Comparable<Name>
and handle the exception in the go() method. Code will compile.
One more thing I found is that the enclosing class reference(Outer.this.str) is not available to the extended inner class(while it is available if referenced from within the inner class directly).
yes, even if the inner class is extended as a named class and the outer class variable is declared public, I'm not able to access the outer class variables in the extended inner class. Is it a bug?
new Vector<String>() is not the runtime type of <? extends Object> but it
is the runtime type of alist at the point of error. We don't know how it will change through the course of program. It's runtime type can keep on changing down the line if we make another assignment. since the runtime type cannot be determined at compile time, generics is limited only to the compile type checking. Hence, the add method on aList is checked for its type on compile type rather than runtime type. This is my guess.
Why is the identifier e# not a legal identifier for java compiler? The rules for valid identifier given in K&B book are:
----------------------------------------------------------
1. Identifiers must start with a letter, a currency character ($), or a connecting character such as the underscore ( _ ). Identifiers cannot start with a number!
2. After the first character, identifiers can contain any combination of letters, currency characters, connecting characters, or numbers.
3. In practice, there is no limit to the number of characters an identifier can contain.
4. You can't use a Java keyword as an identifier. Table 1-1 lists all of the Java keywords including one new one for 5.0, enum.
5. Identifiers in Java are case-sensitive; foo and FOO are two different identifiers.
----------------------------------------------------------
Accordingly the identifer e# doesn't come in any of the above 5 category.
So, why is it not a legal identifier?
Can anyone please let me know the errata link for the SCJP5 book by K&B.
that helped a lot....thanks!!
asList method of Arrays returns a list. This list corresponding to the primitive array has a odd behaviour. E.g.,

String[] sa = {"one", "two", "three", "four"};
List sList = Arrays.asList(sa);
System.out.println("size of list : " + sList.size());

This prints the size as 4. This is fine. However, the same code for primitive array produces the size as always 1.

int[] ia = {1,2,3};
List iList = Arrays.asList(ia);
System.out.println("size of primitive list : " + iList.size());

This prints the size as 1. Is this a bug?
yes, it was because of the 0 to many modifer. A match on the empty string("") for the pattern \d* will give the first execution of match.find() as 0.
Please don't reproduce the content from book. My question is different from
what you have understood. I'll better stop this thread.
quote is used to pass a argument containing spaces(from or by the shell to java) (as otherwise it will be split into two parts and be treated two different arguments). So, using or not using quote for a argument not containing space is not going to make any difference(tested this infact).
The first question in K&b book from chapter.6

And the command line:
java Regex2 "\d*" ab34ef
What is the result?
A. 234
B. 334
C. 2334
D. 0123456
E. 01234456
F. 12334567
G. Compilation fails.

Answer given in book is E. Conceptually the answer is correct. But, when
I execute this in my machine, I don't get anyof the above answers. I have
this file in my D:\ drive under the folder :\work\java\scjp.

The first argument that is getting passed is not "\d*" in my case. But it
is "\downloads". downloads is one of my folder in D:\ drive. However
I'm in the d:\work\java\scjp directory. there is no folder by name "downloads" in this directory(d:\work\java\scjp).

The OS is windows XP. So, the above command line argument is "\d*" only
and not "\\d*"(i even tried the second parameter, which is interpreted by
java as "\\d*" and not "\d*", so no output in this case also).

My question is how to pass the parameter "\d*" in case of windows command
prompt. And the second question is why \d* expanded by the OS looks for
a directory under the root directory(D:\) and not the current directory(d:\work\java\scjp) from which the java was invoked.

Thanks,
Krishna.
Is there an RSS feed for this SCJP forum?