Ming Tan

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

Recent posts by Ming Tan

Hi, all:

I could use some advice. My method takes in a ZipInputStream object and the goal is to create a String object from each entry. My problem is this, the ZipEntry.getSize() statement returns -1 all the time, and without knowing the actual size of the entries, I can't create a byte object, and without the byte object, I can't create the String object. Please help.


Here's my code

public ZipEntry[] findEntriesInZip( ZipInputStream objZip) throws IOException {
// Validate
if( objZip == null )
throw new NullPointerException( "Null JAR parameter passed to " +
"Zips.getFileNamesInZip" );
List objReturnList = new Vector();
ZipEntry entry;
while ((entry = objZip.getNextEntry()) != null){
long size = entry.getSize();
if (size == -1)
size = 100000; //what should I do here?

byte[] bytes = new byte[100000];

int start=0;
int chunk=0;
while (((int)size - start) > 0)
chunk=objZip.read(bytes,start,(int)size - start);
if (chunk==-1)

String s = new String(bytes, 0, start+1, "UTF8");
18 years ago
1. First, if I were the interviewer - I would not ask the question because if someone is certified, he/she is certified. If I have doubts about the quality of the candidate, I would just let him/her do a few questions from Dan's mock exams.
2. When I told my boss about my recent success in SCJP, he didn't ask for my score even though I was hoping he would. So I gave him a copy of the result.
Are you planning to complete your next certification in 10 days too?
21 years ago
My next big thing is SCWCD. Any suggestions of books, study guides, etc?
21 years ago
Dan's mock exams have a total of 500+ questions. among them, about 60 of them are threading questions.
In general, his questions are a little tougher than the real ones.
21 years ago
Could someone please recommend books, study notes, mock exams that I can use to prepare for SCWCD?
I have 1 1/2 years experience in JSP and Servlet.
brand new scjp
I believe Yes. I just took the exam on Saturday, some thread questions that I encountered asked about that.
Whew! I passed with 88% and am very happy about the score.
I would like to thank the following individuals (in no particular order):
1. Velmurugan Periasamy. His study note is awesome.
2. Dan Chisholm. Do his mock exams, especially if you want to do well in the threading questions (I got 7/8 correct). Heck, just do all the questions (500+) and you will be fine.
3. Everyone on javaranch.
4. Authors of "A Programmer's Guide to Java Certification" - Khalid A. Mughal and Rolf W. Rasmussen.
5. Folks at JWhiz
6. Folks at JQPlus (I was the lucky winner of the beta version).
7. Marcus Green. Do his mock exams too.
8. Most importantly, my wife Julie for taking care of our 4 month old while I was studying.
[ March 01, 2003: Message edited by: Ming Tan ]
21 years ago
I am using jdk 1.3.1. May be that's the problem. I am doing 80% in your mock exams and the real exam is this saturday, do you think I am good to go?
In Q8, the question asks which statement would generate compilation error? Dan's answer is //2, my compilar says none, what will Sun Exam say?
(I understand that it doesn't make sense to use strictfp in an abstract method)
abstract class A { // 1
abstract strictfp void m1(); // 2
abstract strictfp class B {} // 3
strictfp class C extends B {} // 4
thanks. what will happen in this case then:
public A go(){
A a = new A();
A aa = new A();
a = aa;
return a;
a is not eligible for gc, how about aa?
[ February 27, 2003: Message edited by: Ming Tan ]
Could you please let me know if an object created in a method will be gc when the execution exits the method?
Consider the following code, which objects will be eligible for gc after the return statement?
public Object objectTest(Object obj) {
Object b = new Object();
Object c, d = new Object();
c = b;
obj = null;
return c;
My answer is b and d. Any thoughts?
What was the rationale to create an extra contstructor for the Float class to take a double primitive value, in addition to the ones that take a String or a float? The rest of the wrapper classes don't have that.
Is it just there so that Dan Chisholm can include that in his mock exams to trick the hell out of everyone?
class TestManager {
static void m(A x, A y) {System.out.print("AA");}
static void m(B x, B y) {System.out.print("BB");}
public static void main(String[] args) {
A a;
B b;
m(b, a);
The output is BBAAAA. Isn't method m(B x, B y) is more specified than m(A x, A y) and output BBBBBB?