🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: aus.computers.java
2 messages
2 total messages Started by KhAiReEl Wed, 21 Jul 1999 00:00
help - Whats wrong with my codes...?
#1111
Author: KhAiReEl
Date: Wed, 21 Jul 1999 00:00
19 lines
971 bytes
I cant seem to compile the following codes. It works okay when I use the
Integer type, but when I need to use the Float, it simply refuses to
compile - and dumb as I am, I dont seem to know the problem.


    float pn;
    int n;
    int i;

    pn = Float.valueOf(txtFld1.getText());  <<=== This is the line with
problem...
    n = Integer.parseInt(txtFld3.getText());


Er.. do I need to declare something else before...?  Please help.

Thank you.
--
Regards
Re: help - Whats wrong with my codes...?
#1112
Author: Dion Gillard
Date: Sat, 24 Jul 1999 00:00
26 lines
1447 bytes
[This followup was posted to aus.computers.java and a copy was sent to 
the cited author.]

In article <7n275a$jh3$1@enyo.uwa.edu.au>, khaireel@tartarus.uwa.edu.au 
says...
|  I cant seem to compile the following codes. It works okay when I use the
|  Integer type, but when I need to use the Float, it simply refuses to
|  compile - and dumb as I am, I dont seem to know the problem.
|  
|  
|      float pn;
|      int n;
|      int i;
|  
|      pn = Float.valueOf(txtFld1.getText());  <<=== This is the line with
|  problem...
|      n = Integer.parseInt(txtFld3.getText());
|  
|  
|  Er.. do I need to declare something else before...?  Please help.
RTFM....Float.valueOf() returns a Float (not the capital F). You have 
declared fn as a flow (not the lower f). try this:

	pn = Float.valueOf(txtFld1.getText()).floatValue();

dIon
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads