- 2
Design a java application which takes input as a number in textfield and add the digits and display it
11 odpowiedzi
+ 3
try parse integer from that string then in a loop you can do some operations to get every digit and finally sum of them
+ 1
So on Netbeans you drag a textfield on your JFrame.
Add a button.
add a label as lblOut
Double click the button.
do lblOut.setText(textfield.getText());
+ 1
ah. You'll need to do int x = Integer.Parse(TextField.getText());
+ 1
also use try and catch to display that it's a wrong input
+ 1
😊
+ 1
If you're still unsure you can always look at this code
https://code.sololearn.com/cBxWC7KgA6EC/?ref=app
0
So where's your problem?
0
simple😀what's the problem
0
Problem is how can we add digits which are taken as input in textfield
0
Actually i have to add the digits of the number taken in taken in textfield and then display it..... So i want to know how to do dat
0
Yeah thankyou..... For help.....