Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hisham Younis   on Feb 08 In Java Category.

  
Question Answered By: Gorkem Yilmaz   on Feb 08

here is some of my code... is there a way to change it so that the
variable being returned as 0.0 can take the value of oneNum, like the
variable test? thanks

public class  treeCounter extends JApplet implements ActionListener {
float oneNum, test;
public void init(){
gV();
test = gV();
System.out.println(test); // returned as 3.0
f = new SampleFrame(output);
}
}

class SampleFrame extends Frame{
// a few variable  declarations
SampleFrame(String title){
// other code in here
Main main = new Main();
main.show();
}
}

class Main extends JFrame{
// variable declarations
public Main(){
treeCounter dp = new treeCounter();
oNum = dp.gV;
System.out.println(oNum); // returned as 0.0
// more code
}
}

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on variable accesibility Or get search suggestion and latest updates.


Tagged: