JButtons is an object?
hi, im a beginner so pardon me if im wrong. Im quite sure that a button is an object. But from my understanding, objects can only be stored in Vectors, why is it that a normal array of buttons can be declared? Help anyone? Thanks
[229 byte] By [
orenjikuro] at [2007-11-19 6:41:51]

# 2 Re: JButtons is an object?
Ok thanks. Now i got another problem, how do i typecast to convert integer to String?
# 3 Re: JButtons is an object?
Hi,
You can't typecast an int to a String. An int is a primitive data type and a String is an object consisting of an array of chars. You can however insert an int into a string, so one of the characters in your String will be the number you specified. However you will not be able to perform any numeric operations on it once it is stored in the String.
int i = 12;
String s = "" + i;
OR
String s = "12";
OR
String s = new String("12");
OR
String s = String.valueOf(i);
Regards
Byron
Bnt at 2007-11-10 2:26:26 >

# 4 Re: JButtons is an object?
You can declare an array of anything, whether it's an array of int, double, String, JButtons, Dates, etc.
There's also an integer wrapper class (aptly named Integer) that you can also use to get a string object representing the int:
String s = Integer.toString(123);
// or;
Integer i = new Integer(321);
String r = i.toString();
cma at 2007-11-10 2:27:29 >
