greenspun.com : LUSENET : Java Programming : One Thread

the container is using FlowLayout, what will result from attempt to compile and execute the following code?

TextField data = new TextField("enter data here", 3); data.addActionListener(this); add(data);

how would you code: Assume that age is a previously defined int variable and that all required import statements have been coded. Code a single statement to extract the text from an existing TextField object named data, convert it to int form and assign it to age. thank you.

-- Nina Mashibe (luxni@yahoo.com), February 04, 2003


you can convert string to int using following command.

int age = Integer.parseInt(data.getText());

hope this will helpful to you.

-- Naeem Shehzad Ghuman (naeemghuman@yahoo.com), September 28, 2004.

Moderation questions? read the FAQ