• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I initialize the variable?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

--------------------Configuration: <Default>--------------------
C:\cccc.java:184: variable c might not have been initialized
Result.setText(Float .toString(ExpectedValue( c)));
^
Note: C:\cccc.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

Process completed.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So here is one of your methods:

What do you mean to be passing in to the ExpectedValue() method?
 
Abeer El-shaer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:So here is one of your methods:

What do you mean to be passing in to the ExpectedValue() method?


yes that's right !
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "Yes, that's right"?

'c' is a local variable to your method. Local variable do not get initialized automatically. So you have to do something like

float c = 0;

or

float c = 234.837;

or

float c = -2323.43432;

But we can't help you more than that, since we have NO idea what c is supposed to represent.
 
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic