Yuan Tseng

Greenhorn
+ Follow
since Mar 11, 2003
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 Yuan Tseng

What is the difference between inner class & nested class? Please an example.
Thanks in advance.
20 years ago
Thanks Joel & Layne for responding so quickly.
Yuan
20 years ago
Hi, I got this question from Sun, and I don't understand that. Is anyone be kindly explained to me? Thanks in advance for all of your help.

//
// This program compiles but won't run successfully.
//
public class WhatHappens {
public static void main(String[] args) {
StringBuffer[] stringBuffers = new StringBuffer[10];
for (int i = 0; i < stringBuffers.length; i ++) {
stringBuffers[i].append("StringBuffer at index " + i);
}
}
}
Answer: The program generates a NullPointerException on line 6. The program creates the array, but does not create the string buffers, so it cannot append any text to them.
20 years ago
Hi, Joel,
It worked.
Thank you for your help.
21 years ago
Hi, Dirk,

I was tried either 'TextPad' or 'SunOne Studio' and they both got the same result 'java.lang.ArrayIndexOutOfBoundsException'.
So I added 'import java.lang.*';' and I still got the same error.
And i think the problem is on 'int m = Integer.parseInt( args[0] );'.
Thanks for your help.
21 years ago
Hi, everyone,

This is the code from "Cattle Drive":
I have no compile error but when I ran I got 'ArrayIndexOutOfBoundsException'.

Please help me to fix that.
Thanks.

Yuan
21 years ago
Thanks for the help everyone...
yuan
21 years ago
hi, everyone,
i was trying to do 'string reverse'. i have no compile error but when execute i got this error messages:
java.lang.ArrayIndexOutOfBoundsException
at Backwards.main(Backwards.java:10)
Exception in thread "main"

and this is the code:
for (i=0; i < str.length; i++);
System.out.print(str[i] + " ");
System.out.println ("\n");
please help me out.
thanks,
yuan
21 years ago
Hi,
i was trying to do this simple count.
code:
int i, n;
n = 0;
{
for (i=1; i < 50; i +=i)
System.out.println (i);
n++;
}
System.out.println ("count: " + n);
}

but i only got count# 1??? (it should be 6).

and please tell me how do i(or where i can find the doc) convert a string from 'lowercase' to 'uppercase'?
thanks for your help.
yuan
21 years ago
is anyone can help me ... i was trying to use 'sun
one studio 4' to run this program but i got this error messages: java.lang.ArrayIndexOutOfBoundsException
at StringReverse.main(Reverse.java:13)
Exception in thread "main"

please tell me how do i correct that?

and on java StringReverse YRRABUKNAHT
how do i set up a test data if i run this on 'sun one stdio 4'?
thanks,
21 years ago
Hi,
i have couple questions for this program.(i got this code from JAVA 2)
// Char
class Char {
public static void main (String args[]) {
char ch;

ch = 'X';
System.out.println ("ch contains " + ch);
ch++;
System.out.println ("ch is now " + ch);
ch = 90;
System.out.println ("ch is now " + ch);
}
}
1. on the ' public static void main (String args[])', but i looked another book 'Thinking in JAVA by Bruce Eckel' and he wrote '(String[] args)'. what's the different?
2. on this output 'ch is now z' not 90 because from ASCII. can you tell me where i can find this document?
thank you for your help.
yuan
21 years ago
hi,
is java has any kind of tools that can show me step-by-step (like vb)?
thanks
yuan
21 years ago
thanks, appreciate the response- I will try it out.
yuan
21 years ago
hi,
i got an error message on compiled "'class' or 'interface' expected. could anyone tell me more about that?
thanks a lot.

yuan
21 years ago
thanks, Karl.
yuan
21 years ago